public static class DateTimeExtension { public static DateTime FirstDayOfMonth(this DateTime bsaeDate) { //return new DateTime(bsaeDate.Year, bsaeDate.Month, 1); return bsaeDate.AddDays(-bsaeDate.Day + 1); } public static DateTime LastDayOfMonth(this DateTime baseDate) { //return new DateTime(baseDate.Year, baseDate.Month + 1, 1).AddDays(-1); return baseDate.AddMonths(1).AddDays(-baseDate.AddMonths(1).Day); } }