日期的设置获取方法
时间:2011-06-10 来源:jack.liangrt
1.
protected void ddlYearMonth_SelectedIndexChanged(object sender, EventArgs e) { if (ddlYearMonth.SelectedValue.Equals("1")) { ddlPeriod.Items.Clear(); ddlYearMonth.SelectedValue = "1"; if (Month == 12) { Year = DateTime.Now.AddYears(1).Year; Month = DateTime.Now.AddMonths(1).Month; } else { days = Convert.ToString(DateTime.DaysInMonth(Year, Month + 1).ToString()); } ddlPeriod.Items.Add(new ListItem("From 1 To " + FirstLockEndDate, "0")); ddlPeriod.Items.Add(new ListItem("From 1 To " + days, "1")); } if (ddlYearMonth.SelectedValue.Equals("0")) { LoadDate(); } }
2.
DataTime dt=new DataTime();