Days From Beginning Of Year Till - CSharp System

CSharp examples for System:DateTime Year

Description

Days From Beginning Of Year Till

Demo Code


using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;//from w w w.jav  a2  s. c  om

public class Main{
        public static int DaysFromBeginningOfYearTill(DateTime datetime)
        {
            DateTime beginningOfYear = new DateTime(datetime.Year, 1, 1);
            return (datetime - beginningOfYear).Days + 1;
        }
}

Related Tutorials