GregorianCalendarTypes Enumeration


Defines the different language versions of the Gregorian calendar.

Namespace:   System.Globalization
Assembly:  mscorlib (in mscorlib.dll)

public enum class GregorianCalendarTypes

Member nameDescription

Refers to the Arabic version of the Gregorian calendar.


Refers to the localized version of the Gregorian calendar, based on the language of the CultureInfo that uses the DateTimeFormatInfo.


Refers to the Middle East French version of the Gregorian calendar.


Refers to the transliterated English version of the Gregorian calendar.


Refers to the transliterated French version of the Gregorian calendar.


Refers to the U.S. English version of the Gregorian calendar.

The date and time patterns associated with the GregorianCalendar vary depending on the language. If the GregorianCalendar is selected in DateTimeFormatInfo::Calendar, GregorianCalendarTypes can be used to specify which date and time patterns to use in that DateTimeFormatInfo.

For Arabic cultures, more language versions of the Gregorian calendar are available. For example, you can use the French version of GregorianCalendar using the MiddleEastFrench value.

A culture that supports GregorianCalendar might not support all language versions of GregorianCalendar. The CultureInfo::Calendar and CultureInfo::OptionalCalendars properties specify the calendars supported by that culture. If GregorianCalendar is supported, CalendarType can be used to determine which language versions of GregorianCalendar are supported.

The following code example demonstrates how to determine the GregorianCalendar language version supported by the culture.

using namespace System;
using namespace System::Globalization;
using namespace System::Collections;
int main()

   // Calendar* myOptCals[] = new CultureInfo(S"ar-SA") -> OptionalCalendars;
   CultureInfo^ MyCI = gcnew CultureInfo( "ar-SA" );
   array<Calendar^>^myOptCals = MyCI->OptionalCalendars;

   // Checks which ones are GregorianCalendar then determines the GregorianCalendar version.
   Console::WriteLine( "The ar-SA culture supports the following calendars:" );
   IEnumerator^ myEnum = myOptCals->GetEnumerator();
   while ( myEnum->MoveNext() )
      Calendar^ cal = safe_cast<Calendar^>(myEnum->Current);
      if ( cal->GetType() == GregorianCalendar::typeid )
         GregorianCalendar^ myGreCal = dynamic_cast<GregorianCalendar^>(cal);
         GregorianCalendarTypes calType = myGreCal->CalendarType;
         Console::WriteLine( " {0} ( {1})", cal, calType );
            Console::WriteLine( " {0}", cal );

This code produces the following output.

The ar-SA culture supports the following calendars:
 System.Globalization.GregorianCalendar ( USEnglish)
 System.Globalization.GregorianCalendar ( MiddleEastFrench)
 System.Globalization.GregorianCalendar ( Arabic)
 System.Globalization.GregorianCalendar ( Localized)
 System.Globalization.GregorianCalendar ( TransliteratedFrench)


The following code example prints a DateTime using a GregorianCalendar that is localized.

using namespace System;
using namespace System::Globalization;
int main()

   // Creates and initializes three different CultureInfo.
   CultureInfo^ myCIdeDE = gcnew CultureInfo( "de-DE",false );
   CultureInfo^ myCIenUS = gcnew CultureInfo( "en-US",false );
   CultureInfo^ myCIfrFR = gcnew CultureInfo( "fr-FR",false );
   CultureInfo^ myCIruRU = gcnew CultureInfo( "ru-RU",false );

   // Creates a Localized GregorianCalendar.
   // GregorianCalendarTypes::Localized is the default when using the GregorianCalendar constructor with->Item[Out] parameters.
   Calendar^ myCal = gcnew GregorianCalendar;

   // Sets the DateTimeFormatInfo::Calendar property to a Localized GregorianCalendar.
   // Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR,
   myCIruRU->DateTimeFormat->Calendar = myCal;

   // Creates a DateTime.
   DateTime myDT = DateTime(2002,1,3,13,30,45);

   // Displays the DateTime.
   Console::WriteLine( "de-DE: {0}", myDT.ToString( "F", myCIdeDE ) );
   Console::WriteLine( "en-US: {0}", myDT.ToString( "F", myCIenUS ) );
   Console::WriteLine( "fr-FR: {0}", myDT.ToString( "F", myCIfrFR ) );
   Console::WriteLine( "ru-RU: {0}", myDT.ToString( "F", myCIruRU ) );

The example displays the following output:
   de-DE: Donnerstag, 3. Januar 2002 13:30:45
   en-US: Thursday, January 03, 2002 1:30:45 PM
   fr-FR: jeudi 3 janvier 2002 13:30:45
   ru-RU: 3 января 2002 г. 13:30:45

Universal Windows Platform
Available since 10
.NET Framework
Available since 1.1
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Return to top