且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何获取所选月份的开始日期和结束日期

更新时间:2023-01-31 15:17:46

试试这些


这将帮助你

如何在C#.net中选择月份的最后一个日期? [ ^ ]


试试这个..:)



try this..: )

DateTime startOfMonth = new DateTime(2014, 5, 1);   //new DateTime(year, month, 1);
DateTime endOfMonth = new DateTime(2014, 5, DateTime.DaysInMonth(2014, 5)); //new DateTime(year, month, DateTime.DaysInMonth(year, month));





,输出为.. :)



5/1/2014 12: 00:00 AM(StartDate)

AND

5/31/2014 12:00:00 AM(结束日期)



and output is.. :)

5/1/2014 12:00:00 AM (StartDate)
AND
5/31/2014 12:00:00 AM(End Date)