日期:2014-05-17  浏览次数:20991 次

c# 求阴历日期
举例
今天是阳历 2012-08-25 阴历就是2012-07-09


我想的就是我输入 阳历日期 直接的得到阴历日期


 2012-08-25=》2012-07-09
  阳历=》阴历

------解决方案--------------------
请参考:
http://wenku.baidu.com/view/dff8a37f168884868762d6ed.html
------解决方案--------------------
直接csdn搜索,会找到你想要的,我以前找到过。
------解决方案--------------------
/// <summary>
/// 公历转为农历的函数
/// </summary>
/// <remarks>作者:行者无疆</remarks>
/// <example>网址:http://www.eeeey.net</example>
/// <param name="solarDateTime">公历日期</param>
/// <returns>农历的日期</returns>
static string SolarToChineseLunisolarDate(DateTime solarDateTime)
{
System.Globalization.ChineseLunisolarCalendar cal = new System.Globalization.ChineseLunisolarCalendar();

int year = cal.GetYear(solarDateTime);
int month = cal.GetMonth(solarDateTime);
int day = cal.GetDayOfMonth(solarDateTime);
int leapMonth = cal.GetLeapMonth(year);
return string.Format("农历{0}{1}({2})年{3}{4}月{5}{6}"
, "甲乙丙丁戊己庚辛壬癸"[(year - 4) % 10]
, "子丑寅卯辰巳午未申酉戌亥"[(year - 4) % 12]
, "鼠牛虎兔龙蛇马羊猴鸡狗猪"[(year - 4) % 12]
, month == leapMonth ? "闰" : ""
, "无正二三四五六七八九十冬腊"[leapMonth > 0 && leapMonth <= month ? month - 1 : month]
, "初十廿三"[day / 10]
, "日一二三四五六七八九"[day % 10]
);
}
 
使用的方法非常简单:
string 农历 = SolarToChineseLunisolarDate(DateTime.Today);

------解决方案--------------------
ASP.NET公历转农历代码 
http://www.eeeey.net/Detail.aspx?ID=58696&Gid=102
------解决方案--------------------
ASP.NET公历转农历代码 
http://www.eeeey.net/Detail.aspx?ID=58696&Gid=102
------解决方案--------------------
...有思路了 改一下 不久变数字了