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();
string time = "2011-06-28 00:00:00";
DateTime dt1 = Convert.ToDateTime(time);
sss.Text = dt1.ToString();