CSharp examples for System:DateTime Month
Last Date Of Month
using System.Globalization; using System;/* www . j a v a 2s . c o m*/ public class Main{ public static DateTime LastDateOfMonth(this DateTime date) { return date.FirstDateOfMonth().AddMonths(1).AddDays(-1).Date; } public static DateTime FirstDateOfMonth(this DateTime date) { return date.AddDays(date.Day*-1 + 1).Date; } }