Mega Code Archive

 
Categories / C# / Date Time
 

GregorianCalendar GetDaysInYear

using System; using System.Globalization; public class SamplesGregorianCalendar  {    public static void Main()  {       GregorianCalendar myCal = new GregorianCalendar();       Console.Write( "CurrentEra:" );       for ( int y = 2001; y <= 2010; y++ )          Console.Write( "\t{0}", myCal.GetDaysInYear( y, 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++ )             Console.Write( "\t{0}", myCal.GetDaysInYear( y, myCal.Eras[i] ) );       }    } }