DateTime now = DateTime.Today;
// To get Last Day DateTime today = DateTime.Now; int lastDay = DateTime.DaysInMonth(today.Year, today.Month); //31 // To Get Last Date DateTime firstDate = new DateTime(today.Year, today.Month, 1); DateTime lastDate = firstDate.AddMonths(1).AddDays(-1); // {07/31/2016 00:00:00}
public static DateTime GetLastDayOfMonth(this DateTime dateTime) { return new DateTime(dateTime.Year, dateTime.Month, DateTime.DaysInMonth(dateTime.Year, dateTime.Month)); }
DateTime today = DateTime.Today; int lastDay = DateTime.DaysInMonth(today.Year, today.Month);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)