Mega Code Archive

 
Categories / C# / Date Time
 

GregorianCalendar IsLeapMonth

using System; using System.Globalization; public class SamplesGregorianCalendar  {    public static void Main()  {       GregorianCalendar myCal = new GregorianCalendar();       int iMonthsInYear;       for ( int y = 2001; y <= 2010; y++ )  {          Console.Write( "{0}:\t", y );          iMonthsInYear = myCal.GetMonthsInYear( y, GregorianCalendar.CurrentEra );          for ( int m = 1; m <= iMonthsInYear; m++ )             Console.Write( "\t{0}", myCal.IsLeapMonth( y, m, GregorianCalendar.CurrentEra ) );       }    } }