See Also: GregorianCalendar Members
The Gregorian calendar recognizes two eras: B.C. or B.C.E., and A.D. or C.E. This implementation of the System.Globalization.GregorianCalendar class recognizes only the current era (A.D. or C.E.).
For information about using the System.Globalization.GregorianCalendar class and the other calendar classes in the .NET Framework, see Working with Calendars.
A leap year in the Gregorian calendar is defined as a year that is evenly divisible by 4, unless it is divisible by 100. However, years that are divisible by 400 are leap years. For example, the year 1900 was not a leap year, but the year 2000 was. A common year has 365 days and a leap year has 366 days.
The Gregorian calendar has 12 months with 28 to 31 days each: January (31 days), February (28 or 29 days), March (31 days), April (30 days), May (31 days), June (30 days), July (31 days), August (31 days), September (30 days), October (31 days), November (30 days), and December (31 days). February has 29 days during leap years and 28 during common years.
By default, all DateTime and DateTimeOffset values express dates and times in the Gregorian calendar.
The Gregorian calendar was developed as a replacement for the Julian calendar (which is represented by the System.Globalization.JulianCalendar class) and was first introduced in a small number of cultures on October 15, 1582. When working with historic dates that precede a culture's adoption of the Gregorian calendar, you should use the original calendar if it is available in the .NET Framework. For example, Denmark changed from the Julian calendar to the Gregorian calendar on February 19 (in the Julian calendar) or March 1 (in the Gregorian calendar) of 1700. In this case, for dates before the adoption of the Gregorian calendar, you should use the Julian calendar. However, note that no culture offers intrinsic support for the System.Globalization.JulianCalendar class. You must use the System.Globalization.JulianCalendar class as a standalone calendar. For more information, see Working with Calendars.
The following example illustrates that February 18, 1700 in the Julian calendar, which is the last day the Julian calendar was officially used in Denmark, is one day earlier than March 1, 1700 in the Gregorian calendar.
code reference: System.Globalization.GregorianCalendar.Class#1
Each System.Globalization.CultureInfo supports a set of calendars. The CultureInfo.Calendar property returns the default calendar for the culture, and the CultureInfo.OptionalCalendars property returns an array containing all the calendars supported by the culture. To change the calendar used by a System.Globalization.CultureInfo, the application can set the DateTimeFormatInfo.Calendar property to a new System.Globalization.Calendar.
DateTimeFormatInfo.GetEra(string) ignores punctuation in abbreviated era names, only if the System.Globalization.GregorianCalendar is selected in DateTimeFormatInfo.Calendar and the culture uses "A.D." as the era name, that is, "A.D." is equivalent to "AD".