CSharp examples for System:DateTime Quarter
Last Date Of Quarter
using System.Globalization; using System;//w w w . ja v a 2 s . c o m public class Main{ public static DateTime LastDateOfQuarter(this DateTime date) { return date.FirstDateOfQuarter().AddMonths(3).AddDays(-1); } public static DateTime FirstDateOfQuarter(this DateTime date) { var quarter = date.Quarter(); var month = (quarter - 1)*3 + 1; return new DateTime(date.Year, month, 1); } }