CSharp examples for System:DateTime Month
Gets the last day of month.
using System;// www .j a v a 2 s.c o m public class Main{ /// <summary> /// Gets the last day of month. /// </summary> /// <param name="date">The date.</param> /// <returns></returns> public static DateTime GetLastDayOfMonth(this DateTime date) { DateTime lastDayOfMonth = new DateTime(date.Year, date.Month + 1, 1).AddDays(-1); return lastDayOfMonth; } }