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 */
public Calendar get_Calendar ()

/** @property */
public void set_Calendar (Calendar value)

public function get Calendar () : Calendar

public function set Calendar (value : Calendar)

Not applicable.

Property Value

The Calendar indicating the calendar to use for the current culture. The default for InvariantInfo is the GregorianCalendar.
Exception typeCondition

ArgumentNullException

The property is being set to a null reference (Nothing in Visual Basic).

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, 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 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.