C# 获取当前月份的天数的方法

 

方法一:

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);

posted @ 2011-07-19 10:17  灵雨飘零  阅读(2701)  评论(0编辑  收藏  举报