This documentation is archived and is not being maintained.

DateTimeFormatInfo.Calendar Property

Gets or sets the calendar to use for the current culture.

[Visual Basic]
Public Property Calendar As Calendar
public Calendar Calendar {get; set;}
public: __property Calendar* get_Calendar();
public: __property void set_Calendar(Calendar*);
public function get Calendar() : Calendar;
public function set Calendar(Calendar);

Property Value

The Calendar indicating the calendar to use for the current culture. The default for InvariantInfo is the GregorianCalendar.


Exception Type Condition
ArgumentNullException The property is being set to a null reference (Nothing in Visual Basic).
ArgumentException The property is being set to a Calendar that is not valid for the current culture.
InvalidOperationException The property is being set and the DateTimeFormatInfo is read-only.


The Calendar property only accepts calendars that are valid for the current culture of the current thread. The CultureInfo.Calendar property specifies the default calendar for the culture and the CultureInfo.OptionalCalendars property specifies other calendars supported by the culture.

Changing the value of this property affects the following properties as well: MonthNames, AbbreviatedMonthNames, DayNames, AbbreviatedDayNames, CalendarWeekRule, FirstDayOfWeek, FullDateTimePattern, LongDatePattern, ShortDatePattern, YearMonthPattern, and MonthDayPattern.

For example, if the culture of the current thread is Japanese, this property accepts JapaneseCalendar, Localized GregorianCalendar, or USEnglish GregorianCalendar. When the JapaneseCalendar is used, the default long date pattern is "gg y'\x5e74'M'\x6708'd'\x65e5'". When the Localized GregorianCalendar, is used, the default long date pattern is "yyyy'\x5e74'M'\x6708'd'\x65e5'".


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DateTimeFormatInfo Class | DateTimeFormatInfo Members | System.Globalization Namespace | Calendar | GregorianCalendar | HebrewCalendar | HijriCalendar | JapaneseCalendar | JulianCalendar | KoreanCalendar | ThaiBuddhistCalendar