公历农历相互转换方
//公历转换为农历
ChineseLunisolarCalendar ChineseCalendar = new ChineseLunisolarCalendar(); int year = ChineseCalendar.GetYear(DateTime.Now); int month = ChineseCalendar.GetMonth(DateTime.Now); int day = ChineseCalendar.GetDayOfMonth(DateTime.Now); string LunarBirthday = string.Format(year+"-"+ month+"-"+ day); model.LunarBirthday =Convert.ToDateTime(LunarBirthday);
//农历转换为公历
ChineseLunisolarCalendar SolarCalendar = new ChineseLunisolarCalendar();
DateTime Birthday = SolarCalendar.ToDateTime(model.LunarBirthday.Year, model.LunarBirthday.Month, model.LunarBirthday.Day, model.LunarBirthday.Hour, model.LunarBirthday.Minute, model.LunarBirthday.Second, model.LunarBirthday.Millisecond);
model.Birthday = Birthday;