方法一:?//最有含量的一种
int days = System.Threading.Thread.CurrentThread.CurrentUICulture.Calendar.GetDaysInMonth(DateTime.Now.Year ,DateTime.Now.Month);??
方法二://最奇怪的一种
DateTime dtNow = DateTime.Today;???? int days = dtNow .AddDays(1 - dtNow .Day).AddMonths(1).AddDays(-1).Day;
方法三:?//最常规的一种
DateTime dtNow = DateTime.Now;???? int days = DateTime.DaysInMonth(dtNow.Year ,dtNow.Month);
?
js
//方法一
function?DayNumOfMonth(Year,Month)
{
????var?d?=?new?Date(Year,Month,0);
????return?d.getDate();
}
//方法二
function?DayNumOfMonth(Year,Month)
{
????Month--;
????var?d?=?new?Date(Year,Month,1);
????d.setDate(d.getDate()+32-d.getDate());
????return?(32-d.getDate());
}
//方法三
function?DayNumOfMonth(Year,Month)
{
????return?32-new?Data(year,month,32).getData();
}