CSharp examples for System:DateTime Year
Finds the first day of year of the specified day.
using System.Globalization; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w . ja v a 2s .c o m*/ public class Main{ /// <summary> /// Finds the first day of year of the specified day. /// </summary> public static DateTime FirstDayOfYear(DateTime y) { return new DateTime(y.Year, 1, 1); } /// <summary> /// Gets the first day of the current year. /// </summary> public static DateTime FirstDayOfYear() { return FirstDayOfYear(DateTime.Today); } }