DateTimeFormatInfo.Calendar Property
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Gets or sets the calendar to use for the current culture.
Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Property Calendar As Calendar
public Calendar Calendar { get; set; }
Property Value
Type: System.Globalization.Calendar
The Calendar indicating the calendar to use for the current culture. The default for InvariantInfo is the GregorianCalendar.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | An attempt was made to set the property to nulla null reference (Nothing in Visual Basic). |
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. |
Remarks
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, LocalizedGregorianCalendar, or USEnglishGregorianCalendar. When the JapaneseCalendar is used, the default long date specifier is "gg y'\x5e74'M'\x6708'd'\x65e5'". When the LocalizedGregorianCalendar, is used, the default long date specifier is "yyyy'\x5e74'M'\x6708'd'\x65e5'".
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.