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 a GregorianCalendar object.

ExceptionCondition
ArgumentNullException

The property is being set to null.

ArgumentOutOfRangeException

The property is being set to a Calendar object that is not valid for the current culture.

InvalidOperationException

The property is being set and the DateTimeFormatInfo object is read-only.

The Calendar property accepts only calendars that are valid for the culture associated with the DateTimeFormatInfo object. For example, if the current object originated from the DateTimeFormat property of an English (United States) CultureInfo object, this property can accept only the calendars that are valid for English (United States). 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'".

.NET Framework

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft