获取当前月的第一天和最后一天
DateTime now = DateTime.Now; DateTime firstDay = new DateTime(now.Year, now.Month, 1); DateTime lastDay = firstDay.AddMonths(1).AddDays(-1);
计算两个日期差多少天
DateTime start=firstDay; DateTime end=lastDay; TimeSpan ts=end.Subtract(start); ts.Days;
时间: 2024-10-21 17:02:05