Year Of Last Day - CSharp System

CSharp examples for System:DateTime Year

Description

Year Of Last Day

Demo Code


using System.Globalization;
using System.Text.RegularExpressions;
using System.Web;
using System.Linq;
using System.Collections.Generic;
using System;/* w  ww  . j  a  va 2 s.  c  o  m*/

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

Related Tutorials