c# 算节气
public static string ChineseTwentyFourDay(DateTime date1) { string[] SolarTerm = new string[] { "小寒", "大寒", "立春", "雨水", "惊蛰", "春分", "清明", "谷雨", "立夏", "小满", "芒种", "夏至", "小暑", "大暑", "立秋", "处暑", "白露", "秋分", "寒露", "霜降", "立冬", "小雪", "大雪", "冬至" }; 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 }; DateTime baseDateAndTime = new DateTime(1900, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM# DateTime newDate; double num; int y; string tempStr = ""; y = date1.Year; for (int i = 1; i <= 24; i++) { num = 525948.76 * (y - 1900) + sTermInfo[i - 1]; newDate = baseDateAndTime.AddMinutes(num);//按分钟计算 if (newDate.DayOfYear == date1.DayOfYear) { tempStr = SolarTerm[i - 1]; break; } } return tempStr; } protected void Page_Load(object sender, EventArgs e) { DateTime dt = new DateTime(2013, 1, 6, 2, 5, 0); //#1/6/1900 2:05:00 AM# string jq = ChineseTwentyFourDay(dt); Response.Write("节气:" + jq); }