Export (0) Print
Expand All

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

The property is being set to null.

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.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 3.5, 2.0, 1.0

XNA Framework

Supported in: 3.0, 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft