Get First Date Of Quarter - CSharp System

CSharp examples for System:DateTime Quarter

Description

Get First Date Of Quarter

Demo Code


using System.Globalization;
using System;/*w ww. j a  v a 2  s  . c  om*/

public class Main{
        public static DateTime GetFirstDateOfQuarter(this DateTime date)
        {
            return new DateTime(date.Year, ((date.Month - 1)/3 + 1 - 1)*3 + 1, 1);
        }
}

Related Tutorials