DateTimeFormatInfo::Calendar Property
Gets or sets the calendar to use for the current culture.
Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
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 | An attempt was made to set the property to nullptr. |
| ArgumentOutOfRangeException | An attempt was made to set the property to a Calendar that is not valid for the current culture. |
| InvalidOperationException | The DateTimeFormatInfo object is read-only. |
The Calendar property accepts only calendars that are valid for the culture associated with this instance of DateTimeFormatInfo. Valid cultures are defined by the CultureInfo::OptionalCalendars property array. 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.
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'".
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.