Date Of Quarter - CSharp System

CSharp examples for System:DateTime Quarter

Description

Date Of Quarter

Demo Code


using System.Globalization;
using System;//from w ww  .j a v  a2s . c o m

public class Main{
        public static int DateOfQuarter(this DateTime date)
        {
            var month = date.Month;
            if (month < 4)
                return 1;
            if (month < 7)
                return 2;
            if (month < 10)
                return 3;
            return 4;
        }
}

Related Tutorials