您的位置:首页 > 其它

公历转农历函数

2012-01-11 13:26 337 查看
class Program
{
static void Main(string[] args)
{
System.Globalization.ChineseLunisolarCalendar chineseLunisolarCalendar = new System.Globalization.ChineseLunisolarCalendar();
DateTime date = DateTime.Now;
int year = chineseLunisolarCalendar.GetYear(date);
int month = chineseLunisolarCalendar.GetMonth(date);
int day = chineseLunisolarCalendar.GetDayOfMonth(date);
Console.WriteLine(string.Format("公历:{0} 农历:{1}", date.ToString("yyyy-MM-dd"), (year + "-" + month + "-" + day)));
Console.Read();
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: