Get Days In Months - CSharp System

CSharp examples for System:DateTime Month

Description

Get Days In Months

Demo Code


using System.Globalization;
using System;/*from w  w w.  j  a v a2s .co  m*/

public class Main{
        public static int[] GetDaysInMonths(int year)
        {
            GregorianCalendar calendar = new GregorianCalendar();
            int[] ret = new int[12];
            for (int i = 0; i < 12; i++)
            {
                ret[i] = calendar.GetDaysInMonth(year, i + 1);
            }
            return ret;
        }
}

Related Tutorials