Windows Dev Center

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

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2015 Microsoft