Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DateTimeFormatInfo.Calendar Property

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

Namespace:  System.Globalization
Assembly:  mscorlib (in mscorlib.dll)
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.
ExceptionCondition
ArgumentNullException

An attempt was made to set the property to null.

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'".

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

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.