CSharp examples for System:DateTime Month
Method for getting last day in month
using System.Threading; using System.Globalization; using System.Collections.Generic; using System;//from w w w . ja va2 s. co m public class Main{ /// <summary> /// Method for getting last day in month /// </summary> /// <param name="date">Date</param> /// <returns>Last day in month</returns> public static DateTime GetLastDay(this DateTime date) { return new DateTime(date.Year, date.Month, DateTime.DaysInMonth(date.Year, date.Month)); } }