1、判断闰年与平年的方法
int intmonth; if(System.DateTime.IsLeapYear(System.DateTime.Now.Date.Year)==true) { intmonth=29; //闰年 } else { intmonth=28; //平年 }
2、获取指定月份的天数
格式为:System.DateTime.DaysInMonth(int 指定的年份,int 指定的月份);
当前月份的天数
int idate=System.DateTime.DaysInMonth(System.DateTime.Now.Year,System.DateTime.Now.Month);
转载请注明原文地址: https://ibbs.8miu.com/read-2218577.html