日期:2014-05-17  浏览次数:20802 次

c# 如何得到某年某月的最后一天
类似于这样,我给出年和月,能得到指定的日期,如2012年10月,给出31号!
public String getLastDayOfMonth(int year, int month) {
  ....
}
 


------解决方案--------------------
DateTime.Now.AddMonths(1)).AddDays(-1);
------解决方案--------------------
int tianshu = DateTime.DaysInMonth(year, month);//指定年,月的整月天数

计算指定的月份,总共多少天