Get Month Last Date - CSharp System

CSharp examples for System:DateTime Month

Description

Get Month Last Date

Demo Code


using System;/*from  w  w  w.  ja v a 2s. c  o m*/

public class Main{
        public static int GetMonthLastDate(int year, int month)
        {
            DateTime lastDay = new DateTime(year, month, new System.Globalization.GregorianCalendar().GetDaysInMonth(year, month));
            int Day = lastDay.Day;
            return Day;
        }
}

Related Tutorials