Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DateTimeFormatInfo.Calendar Property

Gets or sets the calendar to use for the current culture.

[Visual Basic]
Public Property Calendar As Calendar
[C#]
public Calendar Calendar {get; set;}
[C++]
public: __property Calendar* get_Calendar();
public: __property void set_Calendar(Calendar*);
[JScript]
public function get Calendar() : Calendar;
public function set Calendar(Calendar);

Property Value

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

Exceptions

Exception Type Condition
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.

Remarks

The Calendar property only accepts calendars that are valid for the current culture of the current thread. 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 pattern is "gg y'\x5e74'M'\x6708'd'\x65e5'". When the Localized GregorianCalendar, is used, the default long date pattern is "yyyy'\x5e74'M'\x6708'd'\x65e5'".

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

See Also

DateTimeFormatInfo Class | DateTimeFormatInfo Members | System.Globalization Namespace | Calendar | GregorianCalendar | HebrewCalendar | HijriCalendar | JapaneseCalendar | JulianCalendar | KoreanCalendar | ThaiBuddhistCalendar

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft