DateTimeFormatInfo::Calendar Property
Gets or sets the calendar to use for the current culture.
Assembly: mscorlib (in mscorlib.dll)
public: property Calendar^ Calendar { Calendar^ get (); void set (Calendar^ value); }
Property Value
Type: System.Globalization::CalendarThe Calendar indicating the calendar to use for the current culture. The default for InvariantInfo is the GregorianCalendar.
| Exception | Condition |
|---|---|
| ArgumentNullException | The property is being set to nullptr. |
| 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 accepts only calendars that are valid for the culture associated with this instance of DateTimeFormatInfo. For example, if the current instance originated from the DateTimeFormat property of an "en-US" CultureInfo object, this property can accept only the calendars that are valid for the "en-US" culture. 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 specifier is "gg y'\x5e74'M'\x6708'd'\x65e5'". When the Localized GregorianCalendar, is used, the default long date specifier is "yyyy'\x5e74'M'\x6708'd'\x65e5'".
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98, Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC, Xbox 360, Zune
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.