郑德才博客 记录学习,记录工作,学习知识分享!

C# 获得一个月中的天数

public DateTime GetLastDayOfMonth(int Year, int Month)
       {
           //这里的关键就是 DateTime.DaysInMonth 获得一个月中的天数          
           int Days = DateTime.DaysInMonth(Year, Month);
           return Convert.ToDateTime(Year.ToString() + "-" + Month.ToString() + "-" + Days.ToString());
       }
2012年8月16日 | 发布:郑德才博客 | 分类:学习之路 | 评论:0

发表留言: