GregorianCalendar.IsLeapDay : GregorianCalendar « Date Time « C# / C Sharp






GregorianCalendar.IsLeapDay

 

using System;
using System.Globalization;

public class SamplesGregorianCalendar  {
   public static void Main()  {
      GregorianCalendar myCal = new GregorianCalendar();
      int iLastDay;
      Console.Write( "CurrentEra:" );
      for ( int y = 2001; y <= 2010; y++ )  {
         iLastDay = myCal.GetDaysInMonth( y, 2, GregorianCalendar.CurrentEra );
         Console.WriteLine(myCal.IsLeapDay( y, 2, iLastDay, GregorianCalendar.CurrentEra ) );
      }
      for ( int i = 0; i < myCal.Eras.Length; i++ )  {
         Console.Write( "Era {0}:\t", myCal.Eras[i] );
         for ( int y = 2001; y <= 2010; y++ )  {
            iLastDay = myCal.GetDaysInMonth( y, 2, myCal.Eras[i] );
            Console.WriteLine(myCal.IsLeapDay( y, 2, iLastDay, myCal.Eras[i] ) );
         }
      }
   }
}

   
  








Related examples in the same category

1.GregorianCalendar Class
2.GregorianCalendar Constructor
3.GregorianCalendar.AddMonths
4.GregorianCalendar.GetDayOfMonth
5.GregorianCalendar.GetDaysInMonth
6.GregorianCalendar.GetDaysInYear
7.GregorianCalendar.GetMonthsInYear
8.GregorianCalendar.GetWeekOfYear
9.GregorianCalendar.IsLeapMonth
10.GregorianCalendar.IsLeapYear
11.GregorianCalendar.MaxSupportedDateTime
12.GregorianCalendarTypes Enumeration