C#.NET将输入日期与农历日期对应问题,求解 using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Globalization;
public partial class _Default : System.Web.UI.Page { private static ChineseLunisolarCalendar chineseDate = new ChineseLunisolarCalendar(); protected void Page_Load(object sender, EventArgs e) { ShowCurrentYearInfo(); } protected void btnok_Click(object sender, EventArgs e) { Session["year"] = year.Text; int y = Convert.ToInt32(Session["year"]); if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) { Response.Write(Session["year"] + "是闰年"); } else { Response.Write(Session["year"] + "不是闰年"); }
} private void ShowCurrentYearInfo() {
int inYear = Convert.ToInt32(year.Text); int inMonth = Convert.ToInt32(month.Text); int inDate = Convert.ToInt32(date.Text);
int lYear = chineseDate.GetYear(DateTime.Now); int lMonth = chineseDate.GetMonth(DateTime.Now); int lDate = chineseDate.GetDayOfMonth(DateTime.Now);