CSharp examples for System:DateTime Year
To Year Start
using System;/*from w ww.j av a 2s. c om*/ public class Main{ public static DateTime ToYearStart(this DateTime value) { return new DateTime(value.Year, 1, 1); } public static DateTime ToYearStart(this string value) { DateTime date = Convert.ToDateTime(value); return new DateTime(date.Year, 1, 1); } }