Round To Year - CSharp System

CSharp examples for System:DateTime Year

Description

Round To Year

Demo Code


using System.Globalization;
using System.Collections.Generic;
using System;/*from w  ww  . j a  va2  s  .c om*/

public class Main{
        public static DateTime RoundToYear(this DateTime dateTime)
        {
            return new DateTime(dateTime.Year, 1, 1, 0, 0, 0, dateTime.Kind);
        }
}

Related Tutorials