日期:2014-05-19  浏览次数:20682 次

请教C#农历算法!
本人预写日历程序,但不知如何计算农历,跪求C#农历算法!望高人指教!
Email:simon8175@sina.com

------解决方案--------------------
转:
namespace CNCalendar
{
public class CNDate
{
private const ushort START_YEAR = 1901;
private const ushort END_YEAR = 2050;
private string[] ConstellationName =
{
"白羊座 ", "金牛座 ", "双子座 ",
"巨蟹座 ", "狮子座 ", "处女座 ",
"天秤座 ", "天蝎座 ", "射手座 ",
"摩羯座 ", "水瓶座 ", "双鱼座 "};
private string[] LunarHolDayName =
{
"小寒 ", "大寒 ", "立春 ", "雨水 ",
"惊蛰 ", "春分 ", "清明 ", "谷雨 ",
"立夏 ", "小满 ", "芒种 ", "夏至 ",
"小暑 ", "大暑 ", "立秋 ", "处暑 ",
"白露 ", "秋分 ", "寒露 ", "霜降 ",
"立冬 ", "小雪 ", "大雪 ", "冬至 "};

//数组gLunarDay存入阴历1901年到2100年每年中的月天数信息,
//阴历每月只能是29或30天,一年用12(或13)个二进制位表示,对应位为1表30天,否则为29天
private int[] gLunarMonthDay = {
//测试数据只有1901.1.1 --2050.12.31
0x4ae0, 0xa570, 0x5268, 0xd260, 0xd950, 0x6aa8, 0x56a0, 0x9ad0, 0x4ae8, 0x4ae0, //1910
0xa4d8, 0xa4d0, 0xd250, 0xd548, 0xb550, 0x56a0, 0x96d0, 0x95b0, 0x49b8, 0x49b0, //1920
0xa4b0, 0xb258, 0x6a50, 0x6d40, 0xada8, 0x2b60, 0x9570, 0x4978, 0x4970, 0x64b0, //1930
0xd4a0, 0xea50, 0x6d48, 0x5ad0, 0x2b60, 0x9370, 0x92e0, 0xc968, 0xc950, 0xd4a0, //1940
0xda50, 0xb550, 0x56a0, 0xaad8, 0x25d0, 0x92d0, 0xc958, 0xa950, 0xb4a8, 0x6ca0, //1950
0xb550, 0x55a8, 0x4da0, 0xa5b0, 0x52b8, 0x52b0, 0xa950, 0xe950, 0x6aa0, 0xad50, //1960
0xab50, 0x4b60, 0xa570, 0xa570, 0x5260, 0xe930, 0xd950, 0x5aa8, 0x56a0, 0x96d0, //1970
0x4ae8, 0x4ad0, 0xa4d0, 0xd268, 0xd250, 0xd528, 0xb540, 0xb6a0, 0x96d0, 0x95b0, //1980
0x49b0, 0xa4b8, 0xa4b0, 0xb258, 0x6a50, 0x6d40, 0xada0, 0xab60, 0x9370, 0x4978, //1990
0x4970, 0x64b0, 0x6a50, 0xea50, 0x6b28, 0x5ac0, 0xab60, 0x9368, 0x92e0, 0xc960, //2000
0xd4a8, 0xd4a0, 0xda50, 0x5aa8, 0x56a0, 0xaad8, 0x25d0, 0x92d0, 0xc958, 0xa950, //2010
0xb4a0, 0xb550, 0xb550, 0x55a8, 0x4ba0, 0xa5b0, 0x52b8, 0x52b0, 0xa930, 0x74a8, //2020
0x6aa0, 0xad50, 0x4da8, 0x4b60, 0x9570, 0xa4e0, 0xd260, 0xe930, 0xd530, 0x5aa0, //2030
0x6b50, 0x96d0, 0x4ae8, 0x4ad0, 0xa4d0, 0xd258, 0xd250, 0xd520, 0xdaa0, 0xb5a0, //2040
0x56d0, 0x4ad8, 0x49b0, 0xa4b8, 0xa4b0, 0xaa50, 0xb528, 0x6d20, 0xada0, 0x55b0}; //2050

------解决方案--------------------
可以访问我的blog
http://blog.csdn.net/BlueDog/archive/2006/12/13/1440594.aspx