public DateTime LastDayOfMonthFromDateTime(DateTime dateTime) { DateTime firstDayOfTheMonth = new DateTime(dateTime.Year, dateTime.Month, 1); return firstDayOfTheMonth.AddMonths(1).AddDays(-1); }
public int GetDaysInMonth(int month, int year) { DateTime date = DateTime.Now; if (month == 12) date = new DateTime(year + 1, 1, 1); else date = new DateTime(year, month + 1, 1); return date.AddDays(-1).Day; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)