![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif) Code
1 using System;
2 namespace ExpertLib.ChinaSpecial
3![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif) ![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif) {
4![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseCalendarException#region ChineseCalendarException
5![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
6 /// 中国日历异常处理
7 /// </summary>
8 public class ChineseCalendarException : System.Exception
9![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
10 public ChineseCalendarException(string msg) :base(msg)
11![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
12 }
13 }
14![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
15 #endregion
16![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
17![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
18 /// 中国农历类 版本V1.0 支持 1900.1.31日起至 2049.12.31日止的数据
19 /// </summary>
20 /// <remarks>
21 /// 本程序使用数据来源于网上的万年历查询,并综合了一些其它数据
22 /// </remarks>
23 public class ChineseCalendar
24![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
25![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 内部结构#region 内部结构
26 private struct SolarHolidayStruct
27![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
28 public int Month;
29 public int Day;
30 public int Recess; //假期长度
31 public string HolidayName;
32 public SolarHolidayStruct(int month,int day, int recess, string name)
33![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
34 Month = month;
35 Day =day;
36 Recess = recess;
37 HolidayName = name;
38 }
39 }
40![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
41 private struct LunarHolidayStruct
42![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
43 public int Month;
44 public int Day;
45 public int Recess;
46 public string HolidayName;
47![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
48 public LunarHolidayStruct(int month,int day, int recess, string name)
49![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
50 Month = month;
51 Day =day;
52 Recess = recess;
53 HolidayName = name;
54 }
55 }
56![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
57 private struct WeekHolidayStruct
58![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
59 public int Month;
60 public int WeekAtMonth;
61 public int WeekDay;
62 public string HolidayName;
63
64 public WeekHolidayStruct(int month,int weekAtMonth, int weekDay, string name)
65![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
66 Month = month;
67 WeekAtMonth=weekAtMonth;
68 WeekDay = weekDay;
69 HolidayName = name;
70 }
71 }
72 #endregion
73![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
74![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 内部变量#region 内部变量
75 private DateTime _date;
76![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
77 private int _cYear;
78 private int _cMonth;
79 private int _cDay;
80 private bool _cIsLeapMonth; //当月是否闰月
81 private bool _cIsLeapYear; //当年是否有闰月
82 #endregion
83![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
84![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 基础数据#region 基础数据
85![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 基本常量#region 基本常量
86 private const int MinYear = 1900;
87 private const int MaxYear = 2050;
88 private static DateTime MinDay = new DateTime(1900,1,30);
89 private static DateTime MaxDay = new DateTime(2049,12,31);
90 private const int GanZhiStartYear = 1864; //干支计算起始年
91 private static DateTime GanZhiStartDay = new DateTime(1899, 12, 22);//起始日
92 private const string HZNum = "零一二三四五六七八九";
93 private const int AnimalStartYear = 1900; //1900年为鼠年
94 #endregion
95
96![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 阴历数据#region 阴历数据
97![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
98 /// 来源于网上的农历数据
99 /// </summary>
100 /// <remarks>
101 /// 数据结构如下,共使用17位数据
102 /// 第17位:表示闰月天数,0表示29天 1表示30天
103 /// 第16位-第5位(共12位)表示12个月,其中第16位表示第一月,如果该月为30天则为1,29天为0
104 /// 第4位-第1位(共4位)表示闰月是哪个月,如果当年没有闰月,则置0
105 ///</remarks>
106![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) private static int[] LunarDateArray = new int[] {
107 0x04BD8,0x04AE0,0x0A570,0x054D5,0x0D260,0x0D950,0x16554,0x056A0,0x09AD0,0x055D2,
108 0x04AE0,0x0A5B6,0x0A4D0,0x0D250,0x1D255,0x0B540,0x0D6A0,0x0ADA2,0x095B0,0x14977,
109 0x04970,0x0A4B0,0x0B4B5,0x06A50,0x06D40,0x1AB54,0x02B60,0x09570,0x052F2,0x04970,
110 0x06566,0x0D4A0,0x0EA50,0x06E95,0x05AD0,0x02B60,0x186E3,0x092E0,0x1C8D7,0x0C950,
111 0x0D4A0,0x1D8A6,0x0B550,0x056A0,0x1A5B4,0x025D0,0x092D0,0x0D2B2,0x0A950,0x0B557,
112 0x06CA0,0x0B550,0x15355,0x04DA0,0x0A5B0,0x14573,0x052B0,0x0A9A8,0x0E950,0x06AA0,
113 0x0AEA6,0x0AB50,0x04B60,0x0AAE4,0x0A570,0x05260,0x0F263,0x0D950,0x05B57,0x056A0,
114 0x096D0,0x04DD5,0x04AD0,0x0A4D0,0x0D4D4,0x0D250,0x0D558,0x0B540,0x0B6A0,0x195A6,
115 0x095B0,0x049B0,0x0A974,0x0A4B0,0x0B27A,0x06A50,0x06D40,0x0AF46,0x0AB60,0x09570,
116 0x04AF5,0x04970,0x064B0,0x074A3,0x0EA50,0x06B58,0x055C0,0x0AB60,0x096D5,0x092E0,
117 0x0C960,0x0D954,0x0D4A0,0x0DA50,0x07552,0x056A0,0x0ABB7,0x025D0,0x092D0,0x0CAB5,
118 0x0A950,0x0B4A0,0x0BAA4,0x0AD50,0x055D9,0x04BA0,0x0A5B0,0x15176,0x052B0,0x0A930,
119 0x07954,0x06AA0,0x0AD50,0x05B52,0x04B60,0x0A6E6,0x0A4E0,0x0D260,0x0EA65,0x0D530,
120 0x05AA0,0x076A3,0x096D0,0x04BD7,0x04AD0,0x0A4D0,0x1D0B6,0x0D250,0x0D520,0x0DD45,
121 0x0B5A0,0x056D0,0x055B2,0x049B0,0x0A577,0x0A4B0,0x0AA50,0x1B255,0x06D20,0x0ADA0,
122 0x14B63
123 };
124
125 #endregion
126![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
127![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 星座名称#region 星座名称
128 private static string[] _constellationName =
129![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
130 "白羊座", "金牛座", "双子座",
131 "巨蟹座", "狮子座", "处女座",
132 "天秤座", "天蝎座", "射手座",
133 "摩羯座", "水瓶座", "双鱼座"
134 };
135 #endregion
136![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
137![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 二十四节气#region 二十四节气
138 private static string[] _lunarHolidayName =
139![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
140 "小寒", "大寒", "立春", "雨水",
141 "惊蛰", "春分", "清明", "谷雨",
142 "立夏", "小满", "芒种", "夏至",
143 "小暑", "大暑", "立秋", "处暑",
144 "白露", "秋分", "寒露", "霜降",
145 "立冬", "小雪", "大雪", "冬至"
146 };
147 #endregion
148![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
149![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 节气数据#region 节气数据
150![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) private static string[] SolarTerm = new string[] {"小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至"};
151![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) private static int[] sTermInfo = new int[] {0, 21208, 42467, 63836, 85337, 107014, 128867, 150921, 173149, 195551, 218072, 240693, 263343, 285989, 308563, 331033, 353350, 375494, 397447, 419210, 440795, 462224, 483532, 504758};
152 #endregion
153![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
154![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 农历相关数据#region 农历相关数据
155 private static string ganStr = "甲乙丙丁戊己庚辛壬癸";
156 private static string zhiStr = "子丑寅卯辰巳午未申酉戌亥";
157 private static string animalStr = "鼠牛虎兔龙蛇马羊猴鸡狗猪";
158 private static string nStr1 = "日一二三四五六七八九";
159 private static string nStr2 = "初十廿卅";
160 private static string[] _monthString =
161![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
162 "出错","正月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","腊月"
163 };
164 #endregion
165
166![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 按公历计算的节日#region 按公历计算的节日
167![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) private static SolarHolidayStruct[] sHolidayInfo = new SolarHolidayStruct[] {
168 new SolarHolidayStruct(1, 1, 1, "元旦"),
169 new SolarHolidayStruct(2, 2, 0, "世界湿地日"),
170 new SolarHolidayStruct(2, 10, 0, "国际气象节"),
171 new SolarHolidayStruct(2, 14, 0, "情人节"),
172 new SolarHolidayStruct(3, 1, 0, "国际海豹日"),
173 new SolarHolidayStruct(3, 5, 0, "学雷锋纪念日"),
174 new SolarHolidayStruct(3, 8, 0, "妇女节"),
175 new SolarHolidayStruct(3, 12, 0, "植树节 孙中山逝世纪念日"),
176 new SolarHolidayStruct(3, 14, 0, "国际警察日"),
177 new SolarHolidayStruct(3, 15, 0, "消费者权益日"),
178 new SolarHolidayStruct(3, 17, 0, "中国国医节 国际航海日"),
179 new SolarHolidayStruct(3, 21, 0, "世界森林日 消除种族歧视国际日 世界儿歌日"),
180 new SolarHolidayStruct(3, 22, 0, "世界水日"),
181 new SolarHolidayStruct(3, 24, 0, "世界防治结核病日"),
182 new SolarHolidayStruct(4, 1, 0, "愚人节"),
183 new SolarHolidayStruct(4, 7, 0, "世界卫生日"),
184 new SolarHolidayStruct(4, 22, 0, "世界地球日"),
185 new SolarHolidayStruct(5, 1, 1, "劳动节"),
186 new SolarHolidayStruct(5, 2, 1, "劳动节假日"),
187 new SolarHolidayStruct(5, 3, 1, "劳动节假日"),
188 new SolarHolidayStruct(5, 4, 0, "青年节"),
189 new SolarHolidayStruct(5, 8, 0, "世界红十字日"),
190 new SolarHolidayStruct(5, 12, 0, "国际护士节"),
191 new SolarHolidayStruct(5, 31, 0, "世界无烟日"),
192 new SolarHolidayStruct(6, 1, 0, "国际儿童节"),
193 new SolarHolidayStruct(6, 5, 0, "世界环境保护日"),
194 new SolarHolidayStruct(6, 26, 0, "国际禁毒日"),
195 new SolarHolidayStruct(7, 1, 0, "建党节 香港回归纪念 世界建筑日"),
196 new SolarHolidayStruct(7, 11, 0, "世界人口日"),
197 new SolarHolidayStruct(8, 1, 0, "建军节"),
198 new SolarHolidayStruct(8, 8, 0, "中国男子节 父亲节"),
199 new SolarHolidayStruct(8, 15, 0, "抗日战争胜利纪念"),
200 new SolarHolidayStruct(9, 9, 0, "毛泽D逝世纪念"),
201 new SolarHolidayStruct(9, 10, 0, "教师节"),
202 new SolarHolidayStruct(9, 18, 0, "九·一八事变纪念日"),
203 new SolarHolidayStruct(9, 20, 0, "国际爱牙日"),
204 new SolarHolidayStruct(9, 27, 0, "世界旅游日"),
205 new SolarHolidayStruct(9, 28, 0, "孔子诞辰"),
206 new SolarHolidayStruct(10, 1, 1, "国庆节 国际音乐日"),
207 new SolarHolidayStruct(10, 2, 1, "国庆节假日"),
208 new SolarHolidayStruct(10, 3, 1, "国庆节假日"),
209 new SolarHolidayStruct(10, 6, 0, "老人节"),
210 new SolarHolidayStruct(10, 24, 0, "联合国日"),
211 new SolarHolidayStruct(11, 10, 0, "世界青年节"),
212 new SolarHolidayStruct(11, 12, 0, "孙中山诞辰纪念"),
213 new SolarHolidayStruct(12, 1, 0, "世界艾滋病日"),
214 new SolarHolidayStruct(12, 3, 0, "世界残疾人日"),
215 new SolarHolidayStruct(12, 20, 0, "澳门回归纪念"),
216 new SolarHolidayStruct(12, 24, 0, "平安夜"),
217 new SolarHolidayStruct(12, 25, 0, "圣诞节"),
218 new SolarHolidayStruct(12, 26, 0, "毛泽D诞辰纪念")
219 };
220 #endregion
221![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
222![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 按农历计算的节日#region 按农历计算的节日
223![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) private static LunarHolidayStruct[] lHolidayInfo = new LunarHolidayStruct[] {
224 new LunarHolidayStruct(1, 1, 1, "春节"),
225 new LunarHolidayStruct(1, 15, 0, "元宵节"),
226 new LunarHolidayStruct(5, 5, 0, "端午节"),
227 new LunarHolidayStruct(7, 7, 0, "七夕情人节"),
228 new LunarHolidayStruct(7, 15, 0, "中元节 盂兰盆节"),
229 new LunarHolidayStruct(8, 15, 0, "中秋节"),
230 new LunarHolidayStruct(9, 9, 0, "重阳节"),
231 new LunarHolidayStruct(12, 8, 0, "腊八节"),
232 new LunarHolidayStruct(12, 23, 0, "北方小年(扫房)"),
233 new LunarHolidayStruct(12, 24, 0, "南方小年(掸尘)"),
234 //new LunarHolidayStruct(12, 30, 0, "除夕") //注意除夕需要其它方法进行计算
235 };
236 #endregion
237![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
238![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 按某月第几个星期几#region 按某月第几个星期几
239![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) private static WeekHolidayStruct[] wHolidayInfo= new WeekHolidayStruct[] {
240 new WeekHolidayStruct(5, 2, 1, "母亲节"),
241 new WeekHolidayStruct(5, 3, 1, "全国助残日"),
242 new WeekHolidayStruct(6, 3, 1, "父亲节"),
243 new WeekHolidayStruct(9, 3, 3, "国际和平日"),
244 new WeekHolidayStruct(9, 4, 1, "国际聋人节"),
245 new WeekHolidayStruct(10, 1, 2, "国际住房日"),
246 new WeekHolidayStruct(10, 1, 4, "国际减轻自然灾害日"),
247 new WeekHolidayStruct(11, 4, 5, "感恩节")
248 };
249 #endregion
250![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
251 #endregion
252![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
253![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 构造函数#region 构造函数
254![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChinaCalendar <公历日期初始化>#region ChinaCalendar <公历日期初始化>
255![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
256 /// 用一个标准的公历日期来初使化
257 /// </summary>
258 /// <param name="dt"></param>
259 public ChineseCalendar(DateTime dt)
260![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
261 int i;
262 int leap;
263 int temp;
264 int offset;
265![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
266 CheckDateLimit(dt);
267
268 _date = dt.Date;
269
270 //农历日期计算部分
271 leap = 0;
272 temp = 0;
273![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
274 TimeSpan ts = _date - ChineseCalendar.MinDay;//计算两天的基本差距
275 offset = ts.Days;
276![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
277 for (i = MinYear; i <= MaxYear; i++)
278![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
279 temp = GetChineseYearDays(i); //求当年农历年天数
280 if (offset - temp < 1)
281 break;
282 else
283![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
284 offset = offset - temp;
285 }
286 }
287 _cYear = i;
288![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
289 leap = GetChineseLeapMonth(_cYear);//计算该年闰哪个月
290 //设定当年是否有闰月
291 if (leap > 0)
292![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
293 _cIsLeapYear = true;
294 }
295 else
296![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
297 _cIsLeapYear = false;
298 }
299![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
300 _cIsLeapMonth = false;
301 for (i = 1; i <= 12; i++)
302![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
303 //闰月
304 if ((leap > 0) && (i == leap + 1) && (_cIsLeapMonth == false))
305![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
306 _cIsLeapMonth = true;
307 i = i - 1;
308 temp = GetChineseLeapMonthDays(_cYear); //计算闰月天数
309 }
310 else
311![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
312 _cIsLeapMonth = false;
313 temp = GetChineseMonthDays(_cYear, i);//计算非闰月天数
314 }
315![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
316 offset = offset - temp;
317 if (offset <= 0) break;
318 }
319![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
320 offset = offset + temp;
321 _cMonth = i;
322 _cDay = offset;
323 }
324 #endregion
325![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
326![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChinaCalendar <农历日期初始化>#region ChinaCalendar <农历日期初始化>
327![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
328 /// 用农历的日期来初使化
329 /// </summary>
330 /// <param name="cy">农历年</param>
331 /// <param name="cm">农历月</param>
332 /// <param name="cd">农历日</param>
333 /// <param name="LeapFlag">闰月标志</param>
334 public ChineseCalendar(int cy, int cm, int cd, bool leapMonthFlag)
335![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
336 int i,leap,Temp,offset;
337![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
338 CheckChineseDateLimit(cy, cm, cd, leapMonthFlag);
339![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
340 _cYear = cy;
341 _cMonth = cm;
342 _cDay = cd;
343
344 offset = 0;
345
346 for(i = MinYear ;i< cy ;i++)
347![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
348 Temp = GetChineseYearDays(i); //求当年农历年天数
349 offset = offset + Temp;
350 }
351
352 leap = GetChineseLeapMonth(cy);// 计算该年应该闰哪个月
353 if (leap != 0)
354![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
355 this._cIsLeapYear = true;
356 }
357 else
358![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
359 this._cIsLeapYear = false;
360 }
361![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
362 if( cm != leap)
363![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
364 _cIsLeapMonth = false; //当前日期并非闰月
365 }
366 else
367![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
368 _cIsLeapMonth = leapMonthFlag; //使用用户输入的是否闰月月份
369 }
370![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
371![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
372 if ( (_cIsLeapYear == false) || //当年没有闰月
373 (cm < leap )) //计算月份小于闰月
374![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
375![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) #region ![](https://www.cnblogs.com/Images/dot.gif)
376 for (i = 1; i < cm ; i++)
377![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
378 Temp = GetChineseMonthDays(cy, i);//计算非闰月天数
379 offset = offset + Temp;
380 }
381![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
382 //检查日期是否大于最大天
383 if (cd > GetChineseMonthDays(cy, cm))
384![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
385 throw new ChineseCalendarException("不合法的农历日期");
386 }
387 offset = offset + cd; //加上当月的天数
388 #endregion
389 }
390 else //是闰年,且计算月份大于或等于闰月
391![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
392![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) #region ![](https://www.cnblogs.com/Images/dot.gif)
393 for (i = 1; i < cm ; i++)
394![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
395 Temp = GetChineseMonthDays(cy, i); //计算非闰月天数
396 offset = offset + Temp;
397 }
398![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
399 if (cm > leap) //计算月大于闰月
400![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
401 Temp = GetChineseLeapMonthDays(cy); //计算闰月天数
402 offset = offset + Temp; //加上闰月天数
403![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
404 if (cd > GetChineseMonthDays(cy, cm))
405![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
406 throw new ChineseCalendarException("不合法的农历日期");
407 }
408 offset = offset + cd;
409 }
410 else //计算月等于闰月
411![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
412 //如果需要计算的是闰月,则应首先加上与闰月对应的普通月的天数
413 if (this._cIsLeapMonth == true) //计算月为闰月
414![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
415 Temp = GetChineseMonthDays(cy, cm); //计算非闰月天数
416 offset = offset + Temp;
417 }
418![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
419 if (cd > GetChineseLeapMonthDays(cy))
420![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
421 throw new ChineseCalendarException("不合法的农历日期");
422 }
423 offset = offset + cd;
424 }
425 #endregion
426 }
427![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
428
429 _date=MinDay.AddDays(offset);
430 }
431 #endregion
432 #endregion
433![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
434![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 私有函数#region 私有函数
435![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
436![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GetChineseMonthDays#region GetChineseMonthDays
437 //传回农历 y年m月的总天数
438 private int GetChineseMonthDays(int year , int month )
439![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
440 if( BitTest32((LunarDateArray[year - MinYear] & 0x0000FFFF) , (16 - month)))
441![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
442 return 30;
443 }
444 else
445![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
446 return 29;
447 }
448 }
449 #endregion
450![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
451![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GetChineseLeapMonth#region GetChineseLeapMonth
452 //传回农历 y年闰哪个月 1-12 , 没闰传回 0
453 private int GetChineseLeapMonth(int year)
454![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
455
456 return LunarDateArray[year - MinYear] & 0xF;
457![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
458 }
459 #endregion
460![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
461![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GetChineseLeapMonthDays#region GetChineseLeapMonthDays
462 //传回农历 y年闰月的天数
463 private int GetChineseLeapMonthDays(int year)
464![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
465 if(GetChineseLeapMonth(year)!=0)
466![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
467 if((LunarDateArray[year - MinYear] & 0x10000) !=0)
468![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
469 return 30;
470 }
471 else
472![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
473 return 29;
474 }
475 }
476 else
477![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
478 return 0;
479 }
480 }
481 #endregion
482![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
483![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GetChineseYearDays#region GetChineseYearDays
484![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
485 /// 取农历年一年的天数
486 /// </summary>
487 /// <param name="year"></param>
488 /// <returns></returns>
489 private int GetChineseYearDays(int year)
490![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
491 int i,f,sumDay,info;
492![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
493 sumDay=348; //29天 X 12个月
494 i=0x8000;
495 info = LunarDateArray[year - MinYear] & 0x0FFFF;
496![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
497 //计算12个月中有多少天为30天
498 for (int m = 0; m < 12; m++)
499![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
500 f = info & i;
501 if (f != 0)
502![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
503 sumDay++;
504 }
505 i = i >> 1;
506 }
507 return sumDay+ GetChineseLeapMonthDays(year);
508 }
509 #endregion
510![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
511![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) CheckDateLimit#region CheckDateLimit
512![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
513 /// 检查公历日期是否符合要求
514 /// </summary>
515 /// <param name="dt"></param>
516 private void CheckDateLimit(DateTime dt)
517![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
518 if ((dt < MinDay) || (dt > MaxDay))
519![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
520 throw new ChineseCalendarException("超出可转换的日期");
521 }
522 }
523 #endregion
524
525![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) CheckChineseDateLimit#region CheckChineseDateLimit
526![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
527 /// 检查农历日期是否合理
528 /// </summary>
529 /// <param name="year"></param>
530 /// <param name="month"></param>
531 /// <param name="day"></param>
532 /// <param name="leapMonth"></param>
533 private void CheckChineseDateLimit(int year,int month,int day, bool leapMonth)
534![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
535 if( (year < MinYear) || (year > MaxYear) )
536![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
537 throw new ChineseCalendarException("非法农历日期");
538 }
539 if ((month < 1) || (month > 12))
540![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
541 throw new ChineseCalendarException("非法农历日期");
542 }
543 if ((day < 1) || (day > 30)) //中国的月最多30天
544![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
545 throw new ChineseCalendarException("非法农历日期");
546 }
547![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
548 int leap = GetChineseLeapMonth(year);// 计算该年应该闰哪个月
549 if ( (leapMonth == true) &&( month != leap))
550![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
551 throw new ChineseCalendarException("非法农历日期");
552 }
553
554
555 }
556 #endregion
557![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
558![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ConvertNumToChineseNum#region ConvertNumToChineseNum
559![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
560 /// 将0-9转成汉字形式
561 /// </summary>
562 /// <param name="n"></param>
563 /// <returns></returns>
564 private string ConvertNumToChineseNum(char n)
565![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
566 if ((n<'0')||(n > '9')) return "";
567 switch (n)
568![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
569 case '0':
570 return HZNum[0].ToString();
571 case '1':
572 return HZNum[1].ToString();
573 case '2':
574 return HZNum[2].ToString();
575 case '3':
576 return HZNum[3].ToString();
577 case '4':
578 return HZNum[4].ToString();
579 case '5':
580 return HZNum[5].ToString();
581 case '6':
582 return HZNum[6].ToString();
583 case '7':
584 return HZNum[7].ToString();
585 case '8':
586 return HZNum[8].ToString();
587 case '9':
588 return HZNum[9].ToString();
589 default:
590 return "";
591 }
592 }
593 #endregion
594![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
595![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) BitTest32#region BitTest32
596![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
597 /// 测试某位是否为真
598 /// </summary>
599 /// <param name="num"></param>
600 /// <param name="bitpostion"></param>
601 /// <returns></returns>
602 private bool BitTest32(int num, int bitpostion)
603![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
604
605 if ( (bitpostion > 31) || (bitpostion < 0))
606 throw new Exception("Error Param: bitpostion[0-31]:"+ bitpostion.ToString());
607
608 int bit = 1 << bitpostion;
609
610 if ((num & bit) == 0)
611![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
612 return false;
613 }
614 else
615![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
616 return true;
617 }
618 }
619 #endregion
620![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
621![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ConvertDayOfWeek#region ConvertDayOfWeek
622![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
623 /// 将星期几转成数字表示
624 /// </summary>
625 /// <param name="dayOfWeek"></param>
626 /// <returns></returns>
627 private int ConvertDayOfWeek(DayOfWeek dayOfWeek)
628![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
629 switch (dayOfWeek)
630![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
631 case DayOfWeek.Sunday:
632 return 1;
633 case DayOfWeek.Monday:
634 return 2;
635 case DayOfWeek.Tuesday:
636 return 3;
637 case DayOfWeek.Wednesday:
638 return 4;
639 case DayOfWeek.Thursday:
640 return 5;
641 case DayOfWeek.Friday:
642 return 6;
643 case DayOfWeek.Saturday:
644 return 7;
645 default:
646 return 0;
647 }
648 }
649 #endregion
650![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
651![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) CompareWeekDayHoliday#region CompareWeekDayHoliday
652![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
653 /// 比较当天是不是指定的第周几
654 /// </summary>
655 /// <param name="date"></param>
656 /// <param name="month"></param>
657 /// <param name="week"></param>
658 /// <param name="day"></param>
659 /// <returns></returns>
660 private bool CompareWeekDayHoliday(DateTime date, int month, int week, int day)
661![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
662 bool ret = false;
663
664 if (date.Month == month) //月份相同
665![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
666 if (ConvertDayOfWeek(date.DayOfWeek) == day) //星期几相同
667![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
668 DateTime firstDay = new DateTime(date.Year, date.Month, 1);//生成当月第一天
669 int i =ConvertDayOfWeek(firstDay.DayOfWeek);
670 int firWeekDays = 7 - ConvertDayOfWeek(firstDay.DayOfWeek) + 1; //计算第一周剩余天数
671
672 if (i > day)
673![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
674 if ((week-1) * 7 + day + firWeekDays == date.Day)
675![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
676 ret = true;
677 }
678 }
679 else
680![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
681 if ( day + firWeekDays + (week-2) * 7 == date.Day)
682![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
683 ret = true;
684 }
685 }
686 }
687 }
688![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
689 return ret;
690 }
691 #endregion
692 #endregion
693![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
694![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 属性#region 属性
695![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
696![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 节日#region 节日
697![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseCalendarHoliday#region ChineseCalendarHoliday
698![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
699 /// 计算中国农历节日
700 /// </summary>
701 public string ChineseCalendarHoliday
702![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
703 get
704![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
705 string tempStr="";
706 if (this._cIsLeapMonth == false) //闰月不计算节日
707![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
708 foreach (LunarHolidayStruct lh in lHolidayInfo)
709![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
710 if ((lh.Month == this._cMonth) && (lh.Day == this._cDay))
711![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
712![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
713 tempStr = lh.HolidayName;
714 break;
715![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
716 }
717 }
718![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
719 //对除夕进行特别处理
720 if (this._cMonth == 12)
721![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
722 int i = GetChineseMonthDays(this._cYear, 12); //计算当年农历12月的总天数
723 if (this._cDay == i) //如果为最后一天
724![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
725 tempStr = "除夕";
726 }
727 }
728 }
729 return tempStr;
730 }
731 }
732 #endregion
733![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
734![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) WeekDayHoliday#region WeekDayHoliday
735![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
736 /// 按某月第几周第几日计算的节日
737 /// </summary>
738 public string WeekDayHoliday
739![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
740 get
741![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
742 string tempStr = "";
743 foreach (WeekHolidayStruct wh in wHolidayInfo)
744![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
745 if (CompareWeekDayHoliday(_date,wh.Month,wh.WeekAtMonth,wh.WeekDay))
746![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
747 tempStr = wh.HolidayName;
748 break;
749 }
750 }
751 return tempStr;
752 }
753 }
754 #endregion
755![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
756![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) DateHoliday#region DateHoliday
757![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
758 /// 按公历日计算的节日
759 /// </summary>
760 public string DateHoliday
761![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
762 get
763![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
764 string tempStr = "";
765![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
766 foreach (SolarHolidayStruct sh in sHolidayInfo)
767![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
768 if ((sh.Month == _date.Month) && (sh.Day == _date.Day))
769![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
770 tempStr = sh.HolidayName;
771 break;
772 }
773 }
774 return tempStr;
775 }
776 }
777 #endregion
778 #endregion
779![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
780![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 公历日期#region 公历日期
781![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) Date#region Date
782![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
783 /// 取对应的公历日期
784 /// </summary>
785 public DateTime Date
786![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
787![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return _date; }
788![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) set { _date = value; }
789 }
790 #endregion
791![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
792![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) WeekDay#region WeekDay
793![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
794 /// 取星期几
795 /// </summary>
796 public DayOfWeek WeekDay
797![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
798![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return _date.DayOfWeek; }
799 }
800 #endregion
801![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
802![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) WeekDayStr#region WeekDayStr
803![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
804 /// 周几的字符
805 /// </summary>
806 public string WeekDayStr
807![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
808 get
809![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
810 switch (_date.DayOfWeek)
811![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
812 case DayOfWeek.Sunday:
813 return "星期日";
814 case DayOfWeek.Monday:
815 return "星期一";
816 case DayOfWeek.Tuesday:
817 return "星期二";
818 case DayOfWeek.Wednesday:
819 return "星期三";
820 case DayOfWeek.Thursday:
821 return "星期四";
822 case DayOfWeek.Friday:
823 return "星期五";
824 default:
825 return "星期六";
826 }
827 }
828 }
829 #endregion
830![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
831![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) DateString#region DateString
832![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
833 /// 公历日期中文表示法 如一九九七年七月一日
834 /// </summary>
835 public string DateString
836![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
837 get
838![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
839 return "公元"+ this._date.ToLongDateString();
840 }
841 }
842 #endregion
843![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
844![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) IsLeapYear#region IsLeapYear
845![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
846 /// 当前是否公历闰年
847 /// </summary>
848 public bool IsLeapYear
849![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
850 get
851![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
852 return DateTime.IsLeapYear(this._date.Year);
853 }
854 }
855 #endregion
856 #endregion
857![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
858![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 农历日期#region 农历日期
859![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) IsChineseLeapMonth#region IsChineseLeapMonth
860![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
861 /// 是否闰月
862 /// </summary>
863 public bool IsChineseLeapMonth
864![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
865![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return this._cIsLeapMonth; }
866 }
867 #endregion
868![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
869![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) IsChineseLeapYear#region IsChineseLeapYear
870![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
871 /// 当年是否有闰月
872 /// </summary>
873 public bool IsChineseLeapYear
874![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
875 get
876![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
877 return this._cIsLeapYear;
878 }
879 }
880 #endregion
881![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
882![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseDay#region ChineseDay
883![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
884 /// 农历日
885 /// </summary>
886 public int ChineseDay
887![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
888![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return this._cDay; }
889 }
890 #endregion
891![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
892![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseDayString#region ChineseDayString
893![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
894 /// 农历日中文表示
895 /// </summary>
896 public string ChineseDayString
897![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
898 get
899![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
900 switch(this._cDay)
901![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
902 case 0:
903 return "";
904 case 10:
905 return "初十";
906 case 20:
907 return "二十";
908 case 30:
909 return "三十";
910 default:
911 return nStr2[(int)(_cDay / 10)].ToString() + nStr1[_cDay % 10].ToString();
912
913 }
914 }
915 }
916 #endregion
917![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
918![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseMonth#region ChineseMonth
919![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
920 /// 农历的月份
921 /// </summary>
922 public int ChineseMonth
923![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
924![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return this._cMonth; }
925 }
926 #endregion
927![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
928![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseMonthString#region ChineseMonthString
929![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
930 /// 农历月份字符串
931 /// </summary>
932 public string ChineseMonthString
933![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
934 get
935![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
936 return _monthString[this._cMonth];
937 }
938 }
939 #endregion
940![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
941![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseYear#region ChineseYear
942![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
943 /// 取农历年份
944 /// </summary>
945 public int ChineseYear
946![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
947![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get { return this._cYear; }
948 }
949 #endregion
950![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
951![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseYearString#region ChineseYearString
952![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
953 /// 取农历年字符串如,一九九七年
954 /// </summary>
955 public string ChineseYearString
956![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
957 get
958![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
959 string tempStr="";
960 string num = this._cYear.ToString();
961 for (int i = 0; i < 4; i++)
962![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
963 tempStr += ConvertNumToChineseNum(num[i]);
964 }
965 return tempStr+"年";
966 }
967 }
968 #endregion
969![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
970![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseDateString#region ChineseDateString
971![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
972 /// 取农历日期表示法:农历一九九七年正月初五
973 /// </summary>
974 public string ChineseDateString
975![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
976 get
977![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
978 if (this._cIsLeapMonth == true)
979![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
980 return "农历" + ChineseYearString + "闰" + ChineseMonthString + ChineseDayString;
981 }
982 else
983![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
984 return "农历" + ChineseYearString + ChineseMonthString + ChineseDayString;
985 }
986 }
987 }
988 #endregion
989![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
990![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) ChineseTwentyFourDay#region ChineseTwentyFourDay
991![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
992 /// 定气法计算二十四节气,二十四节气是按地球公转来计算的,并非是阴历计算的
993 /// </summary>
994 /// <remarks>
995 /// 节气的定法有两种。古代历法采用的称为"恒气",即按时间把一年等分为24份,
996 /// 每一节气平均得15天有余,所以又称"平气"。现代农历采用的称为"定气",即
997 /// 按地球在轨道上的位置为标准,一周360°,两节气之间相隔15°。由于冬至时地
998 /// 球位于近日点附近,运动速度较快,因而太阳在黄道上移动15°的时间不到15天。
999 /// 夏至前后的情况正好相反,太阳在黄道上移动较慢,一个节气达16天之多。采用
1000 /// 定气时可以保证春、秋两分必然在昼夜平分的那两天。
1001 /// </remarks>
1002 public string ChineseTwentyFourDay
1003![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1004 get
1005![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1006 DateTime baseDateAndTime = new DateTime(1900,1,6,2,5,0); //#1/6/1900 2:05:00 AM#
1007 DateTime newDate;
1008 double num;
1009 int y;
1010 string tempStr="";
1011![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1012 y = this._date.Year;
1013![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1014 for(int i=1;i<=24;i++)
1015![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1016 num = 525948.76 * (y - 1900) + sTermInfo[i - 1];
1017
1018 newDate = baseDateAndTime.AddMinutes(num);//按分钟计算
1019 if( newDate.DayOfYear == _date.DayOfYear)
1020![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1021 tempStr =SolarTerm[i - 1];
1022 break;
1023 }
1024 }
1025 return tempStr;
1026 }
1027 }
1028 #endregion
1029 #endregion
1030
1031![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 星座#region 星座
1032![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) Constellation#region Constellation
1033![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1034 /// 计算指定日期的星座序号
1035 /// </summary>
1036 /// <returns></returns>
1037 public string Constellation
1038![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1039![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) get {
1040 int index=0;
1041 int y, m, d;
1042 y = _date.Year;
1043 m = _date.Month;
1044 d = _date.Day;
1045 y = m * 100 + d;
1046
1047![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) if (((y >= 321) && (y <= 419))) { index = 0; }
1048![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 420) && (y <= 520)) { index = 1; }
1049![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 521) && (y <= 620)) { index = 2; }
1050![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 621) && (y <= 722)) { index = 3; }
1051![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 723) && (y <= 822)) { index = 4; }
1052![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 823) && (y <= 922)) { index = 5; }
1053![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 923) && (y <= 1022)) { index = 6; }
1054![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 1023) && (y <= 1121)) { index = 7; }
1055![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 1122) && (y <= 1221)) { index = 8; }
1056![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 1222) || (y <= 119)) { index = 9; }
1057![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 120) && (y <= 218)) { index = 10; }
1058![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else if ((y >= 219) && (y <= 320)) { index = 11; }
1059![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) else { index = 0; }
1060![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1061 return _constellationName[index];
1062 }
1063 }
1064 #endregion
1065 #endregion
1066![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1067![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 属相#region 属相
1068![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) Animal#region Animal
1069![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1070 /// 计算属相的索引,注意虽然属相是以农历年来区别的,但是目前在实际使用中是按公历来计算的
1071 /// 鼠年为1,其它类推
1072 /// </summary>
1073 public int Animal
1074![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1075 get
1076![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1077 int offset = _date.Year - AnimalStartYear;
1078 return (offset % 12) + 1;
1079 }
1080 }
1081 #endregion
1082![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1083![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) AnimalString#region AnimalString
1084![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1085 /// 取属相字符串
1086 /// </summary>
1087 public string AnimalString
1088![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1089 get
1090![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1091 int offset = _date.Year - AnimalStartYear;
1092 return animalStr[offset % 12].ToString();
1093 }
1094 }
1095 #endregion
1096 #endregion
1097![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1098![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 天干地支#region 天干地支
1099![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GanZhiYearString#region GanZhiYearString
1100![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1101 /// 取农历年的干支表示法如 乙丑年
1102 /// </summary>
1103 public string GanZhiYearString
1104![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1105 get
1106![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1107 string tempStr;
1108 int i=(this._cYear - GanZhiStartYear) % 60; //计算干支
1109 tempStr = ganStr[i % 10].ToString() + zhiStr[i % 12].ToString() + "年";
1110 return tempStr;
1111 }
1112 }
1113 #endregion
1114![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1115![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GanZhiMonthString#region GanZhiMonthString
1116![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1117 /// 取干支的月表示字符串,注意农历的闰月不记干支
1118 /// </summary>
1119 public string GanZhiMonthString
1120![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1121 get
1122![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1123 //每个月的地支总是固定的,而且总是从寅月开始
1124 int zhiIndex;
1125 string zhi;
1126 if (this._cMonth > 10)
1127![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1128 zhiIndex = this._cMonth - 10;
1129 }
1130 else
1131![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1132 zhiIndex = this._cMonth + 2;
1133 }
1134 zhi = zhiStr[zhiIndex - 1].ToString();
1135![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1136 //根据当年的干支年的干来计算月干的第一个
1137 int ganIndex=1;
1138 string gan;
1139 int i = (this._cYear - GanZhiStartYear) % 60; //计算干支
1140 switch (i%10)
1141![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1142![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) #region ![](https://www.cnblogs.com/Images/dot.gif)
1143 case 0: //甲
1144 ganIndex = 3;
1145 break;
1146 case 1: //乙
1147 ganIndex = 5;
1148 break;
1149 case 2: //丙
1150 ganIndex = 7;
1151 break;
1152 case 3: //丁
1153 ganIndex = 9;
1154 break;
1155 case 4: //戊
1156 ganIndex = 1;
1157 break;
1158 case 5: //己
1159 ganIndex = 3;
1160 break;
1161 case 6: //庚
1162 ganIndex = 5;
1163 break;
1164 case 7: //辛
1165 ganIndex = 7;
1166 break;
1167 case 8: //壬
1168 ganIndex = 9;
1169 break;
1170 case 9: //癸
1171 ganIndex = 1;
1172 break;
1173 #endregion
1174 }
1175 gan = ganStr[(ganIndex + this._cMonth -2) % 10].ToString();
1176![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1177 return gan + zhi + "月";
1178 }
1179 }
1180 #endregion
1181![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1182![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GanZhiDayString#region GanZhiDayString
1183![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1184 /// 取干支日表示法
1185 /// </summary>
1186 public string GanZhiDayString
1187![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1188 get
1189![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1190 int i,offset;
1191 TimeSpan ts = this._date - GanZhiStartDay;
1192 offset = ts.Days;
1193 i = offset % 60;
1194 return ganStr[i % 10].ToString() + zhiStr[i % 12].ToString() + "日";
1195 }
1196 }
1197 #endregion
1198![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1199![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) GanZhiDateString#region GanZhiDateString
1200![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1201 /// 取当前日期的干支表示法如 甲子年乙丑月丙庚日
1202 /// </summary>
1203 public string GanZhiDateString
1204![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1205 get
1206![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1207 return GanZhiYearString + GanZhiMonthString + GanZhiDayString;
1208 }
1209 }
1210 #endregion
1211 #endregion
1212 #endregion
1213![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1214![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) 方法#region 方法
1215![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) NextDay#region NextDay
1216![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1217 /// 取下一天
1218 /// </summary>
1219 /// <returns></returns>
1220 public ChineseCalendar NextDay()
1221![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1222 DateTime nextDay = _date.AddDays(1);
1223 return new ChineseCalendar(nextDay);
1224 }
1225 #endregion
1226![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
1227![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedSubBlock.gif) PervDay#region PervDay
1228![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) /**//// <summary>
1229 /// 取前一天
1230 /// </summary>
1231 /// <returns></returns>
1232 public ChineseCalendar PervDay()
1233![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedSubBlockStart.gif) {
1234 DateTime pervDay = _date.AddDays(-1);
1235 return new ChineseCalendar(pervDay);
1236 }
1237 #endregion
1238 #endregion
1239 }
1240 }
1241![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
|