//第一种
public int GetDay1()
{
DateTime dt = DateTime.Now;
int dt = DateTime.DaysInMonth(dt.Year, dt.Month);
return day;
}
//第二种
public int GetDay2()
{
DateTime dt = DateTime.Today;
int day = dt.AddDays(1 - dt.Day).AddMonths(1).AddDays(-1).Day;
return day;
}
//第三种
public int GetDay3()
{
int day = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
return day;
}