Year Of First Day - CSharp System

CSharp examples for System:DateTime Year

Description

Year Of First Day

Demo Code


using System.Globalization;
using System.Text.RegularExpressions;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;//  w w w.j  a  v  a 2 s.co  m

public class Main{
            public static DateTime YearOfFirstDay(int year)
            {
                if (year <= 0001 || year >= 9999) return DateTime.MaxValue;
                DateTime result = DateTime.MinValue;
                DateTime.TryParse(string.Format("{0}-01-01", year), out result);
                return result;
            }
}

Related Tutorials