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

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

public function get Calendar () : Calendar

public function set Calendar (value : Calendar)

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 instance, 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 pattern is "gg y'\x5e74'M'\x6708'd'\x65e5'". When the LocalizedGregorianCalendar, is used, the default long date pattern is "yyyy'\x5e74'M'\x6708'd'\x65e5'".

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft