CSharp examples for System:DateTime Year
Returns the FIRST possible time unit for provided YEAR in dateTime
using System.Globalization; using System;/*from w ww . jav a2 s . c om*/ public class Main{ /// <summary> /// Returns the FIRST possible time unit for provided YEAR in dateTime /// </summary> public static DateTime StartOfYear(this DateTime dateTime) { var startOfYear = new DateTime(dateTime.Year, 1, 1); return startOfYear; } }