mscorlib(4.0.0.0) API with additions
System.Globalization.Calendar Class Referenceabstract

Represents time in divisions, such as weeks, months, and years. More...

Inheritance diagram for System.Globalization.Calendar:
[legend]
Collaboration diagram for System.Globalization.Calendar:
[legend]

Public Member Functions

virtual object Clone ()
 Creates a new object that is a copy of the current T:System.Globalization.Calendar object. More...
 
virtual DateTime AddMilliseconds (DateTime time, double milliseconds)
 Returns a T:System.DateTime that is the specified number of milliseconds away from the specified T:System.DateTime. More...
 
virtual DateTime AddDays (DateTime time, int days)
 Returns a T:System.DateTime that is the specified number of days away from the specified T:System.DateTime. More...
 
virtual DateTime AddHours (DateTime time, int hours)
 Returns a T:System.DateTime that is the specified number of hours away from the specified T:System.DateTime. More...
 
virtual DateTime AddMinutes (DateTime time, int minutes)
 Returns a T:System.DateTime that is the specified number of minutes away from the specified T:System.DateTime. More...
 
abstract DateTime AddMonths (DateTime time, int months)
 When overridden in a derived class, returns a T:System.DateTime that is the specified number of months away from the specified T:System.DateTime. More...
 
virtual DateTime AddSeconds (DateTime time, int seconds)
 Returns a T:System.DateTime that is the specified number of seconds away from the specified T:System.DateTime. More...
 
virtual DateTime AddWeeks (DateTime time, int weeks)
 Returns a T:System.DateTime that is the specified number of weeks away from the specified T:System.DateTime. More...
 
abstract DateTime AddYears (DateTime time, int years)
 When overridden in a derived class, returns a T:System.DateTime that is the specified number of years away from the specified T:System.DateTime. More...
 
abstract int GetDayOfMonth (DateTime time)
 When overridden in a derived class, returns the day of the month in the specified T:System.DateTime. More...
 
abstract DayOfWeek GetDayOfWeek (DateTime time)
 When overridden in a derived class, returns the day of the week in the specified T:System.DateTime. More...
 
abstract int GetDayOfYear (DateTime time)
 When overridden in a derived class, returns the day of the year in the specified T:System.DateTime. More...
 
virtual int GetDaysInMonth (int year, int month)
 Returns the number of days in the specified month and year of the current era. More...
 
abstract int GetDaysInMonth (int year, int month, int era)
 When overridden in a derived class, returns the number of days in the specified month, year, and era. More...
 
virtual int GetDaysInYear (int year)
 Returns the number of days in the specified year of the current era. More...
 
abstract int GetDaysInYear (int year, int era)
 When overridden in a derived class, returns the number of days in the specified year and era. More...
 
abstract int GetEra (DateTime time)
 When overridden in a derived class, returns the era in the specified T:System.DateTime. More...
 
virtual int GetHour (DateTime time)
 Returns the hours value in the specified T:System.DateTime. More...
 
virtual double GetMilliseconds (DateTime time)
 Returns the milliseconds value in the specified T:System.DateTime. More...
 
virtual int GetMinute (DateTime time)
 Returns the minutes value in the specified T:System.DateTime. More...
 
abstract int GetMonth (DateTime time)
 When overridden in a derived class, returns the month in the specified T:System.DateTime. More...
 
virtual int GetMonthsInYear (int year)
 Returns the number of months in the specified year in the current era. More...
 
abstract int GetMonthsInYear (int year, int era)
 When overridden in a derived class, returns the number of months in the specified year in the specified era. More...
 
virtual int GetSecond (DateTime time)
 Returns the seconds value in the specified T:System.DateTime. More...
 
virtual int GetWeekOfYear (DateTime time, CalendarWeekRule rule, DayOfWeek firstDayOfWeek)
 Returns the week of the year that includes the date in the specified T:System.DateTime value. More...
 
abstract int GetYear (DateTime time)
 When overridden in a derived class, returns the year in the specified T:System.DateTime. More...
 
virtual bool IsLeapDay (int year, int month, int day)
 Determines whether the specified date in the current era is a leap day. More...
 
abstract bool IsLeapDay (int year, int month, int day, int era)
 When overridden in a derived class, determines whether the specified date in the specified era is a leap day. More...
 
virtual bool IsLeapMonth (int year, int month)
 Determines whether the specified month in the specified year in the current era is a leap month. More...
 
abstract bool IsLeapMonth (int year, int month, int era)
 When overridden in a derived class, determines whether the specified month in the specified year in the specified era is a leap month. More...
 
virtual int GetLeapMonth (int year)
 Calculates the leap month for a specified year. More...
 
virtual int GetLeapMonth (int year, int era)
 Calculates the leap month for a specified year and era. More...
 
virtual bool IsLeapYear (int year)
 Determines whether the specified year in the current era is a leap year. More...
 
abstract bool IsLeapYear (int year, int era)
 When overridden in a derived class, determines whether the specified year in the specified era is a leap year. More...
 
virtual DateTime ToDateTime (int year, int month, int day, int hour, int minute, int second, int millisecond)
 Returns a T:System.DateTime that is set to the specified date and time in the current era. More...
 
abstract DateTime ToDateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
 When overridden in a derived class, returns a T:System.DateTime that is set to the specified date and time in the specified era. More...
 
virtual int ToFourDigitYear (int year)
 Converts the specified year to a four-digit year by using the P:System.Globalization.Calendar.TwoDigitYearMax property to determine the appropriate century. More...
 

Static Public Member Functions

static Calendar ReadOnly (Calendar calendar)
 Returns a read-only version of the specified T:System.Globalization.Calendar object. More...
 

Public Attributes

const int CurrentEra = 0
 Represents the current era of the current calendar. More...
 

Protected Member Functions

 Calendar ()
 Initializes a new instance of the T:System.Globalization.Calendar class. More...
 

Protected Attributes

virtual int DaysInYearBeforeMinSupportedYear => 365
 Gets the number of days in the year that precedes the year that is specified by the P:System.Globalization.Calendar.MinSupportedDateTime property. More...
 

Properties

virtual DateTime MinSupportedDateTime [get]
 Gets the earliest date and time supported by this T:System.Globalization.Calendar object. More...
 
virtual DateTime MaxSupportedDateTime [get]
 Gets the latest date and time supported by this T:System.Globalization.Calendar object. More...
 
virtual CalendarAlgorithmType AlgorithmType [get]
 Gets a value indicating whether the current calendar is solar-based, lunar-based, or a combination of both. More...
 
bool IsReadOnly [get]
 Gets a value indicating whether this T:System.Globalization.Calendar object is read-only. More...
 
abstract int [] Eras [get]
 When overridden in a derived class, gets the list of eras in the current calendar. More...
 
virtual int TwoDigitYearMax [get, set]
 Gets or sets the last year of a 100-year range that can be represented by a 2-digit year. More...
 

Detailed Description

Represents time in divisions, such as weeks, months, and years.

Definition at line 11 of file Calendar.cs.

Constructor & Destructor Documentation

◆ Calendar()

System.Globalization.Calendar.Calendar ( )
protected

Initializes a new instance of the T:System.Globalization.Calendar class.

Definition at line 201 of file Calendar.cs.

Member Function Documentation

◆ AddDays()

virtual DateTime System.Globalization.Calendar.AddDays ( DateTime  time,
int  days 
)
virtual

Returns a T:System.DateTime that is the specified number of days away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add days.
daysThe number of days to add.
Returns
The T:System.DateTime that results from adding the specified number of days to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptiondays is outside the supported range of the T:System.DateTime return value.

Definition at line 291 of file Calendar.cs.

◆ AddHours()

virtual DateTime System.Globalization.Calendar.AddHours ( DateTime  time,
int  hours 
)
virtual

Returns a T:System.DateTime that is the specified number of hours away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add hours.
hoursThe number of hours to add.
Returns
The T:System.DateTime that results from adding the specified number of hours to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionhours is outside the supported range of the T:System.DateTime return value.

Definition at line 304 of file Calendar.cs.

◆ AddMilliseconds()

virtual DateTime System.Globalization.Calendar.AddMilliseconds ( DateTime  time,
double  milliseconds 
)
virtual

Returns a T:System.DateTime that is the specified number of milliseconds away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to add milliseconds to.
millisecondsThe number of milliseconds to add.
Returns
The T:System.DateTime that results from adding the specified number of milliseconds to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionmilliseconds is outside the supported range of the T:System.DateTime return value.

Definition at line 278 of file Calendar.cs.

◆ AddMinutes()

virtual DateTime System.Globalization.Calendar.AddMinutes ( DateTime  time,
int  minutes 
)
virtual

Returns a T:System.DateTime that is the specified number of minutes away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add minutes.
minutesThe number of minutes to add.
Returns
The T:System.DateTime that results from adding the specified number of minutes to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionminutes is outside the supported range of the T:System.DateTime return value.

Definition at line 317 of file Calendar.cs.

◆ AddMonths()

abstract DateTime System.Globalization.Calendar.AddMonths ( DateTime  time,
int  months 
)
pure virtual

When overridden in a derived class, returns a T:System.DateTime that is the specified number of months away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add months.
monthsThe number of months to add.
Returns
The T:System.DateTime that results from adding the specified number of months to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionmonths is outside the supported range of the T:System.DateTime return value.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ AddSeconds()

virtual DateTime System.Globalization.Calendar.AddSeconds ( DateTime  time,
int  seconds 
)
virtual

Returns a T:System.DateTime that is the specified number of seconds away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add seconds.
secondsThe number of seconds to add.
Returns
The T:System.DateTime that results from adding the specified number of seconds to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionseconds is outside the supported range of the T:System.DateTime return value.

Definition at line 340 of file Calendar.cs.

◆ AddWeeks()

virtual DateTime System.Globalization.Calendar.AddWeeks ( DateTime  time,
int  weeks 
)
virtual

Returns a T:System.DateTime that is the specified number of weeks away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add weeks.
weeksThe number of weeks to add.
Returns
The T:System.DateTime that results from adding the specified number of weeks to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionweeks is outside the supported range of the T:System.DateTime return value.

Definition at line 353 of file Calendar.cs.

◆ AddYears()

abstract DateTime System.Globalization.Calendar.AddYears ( DateTime  time,
int  years 
)
pure virtual

When overridden in a derived class, returns a T:System.DateTime that is the specified number of years away from the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to which to add years.
yearsThe number of years to add.
Returns
The T:System.DateTime that results from adding the specified number of years to the specified T:System.DateTime.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range of this calendar.
T:System.ArgumentOutOfRangeExceptionyears is outside the supported range of the T:System.DateTime return value.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.PersianCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ Clone()

virtual object System.Globalization.Calendar.Clone ( )
virtual

Creates a new object that is a copy of the current T:System.Globalization.Calendar object.

Returns
A new instance of T:System.Object that is the memberwise clone of the current T:System.Globalization.Calendar object.

Implements System.ICloneable.

Definition at line 208 of file Calendar.cs.

◆ GetDayOfMonth()

abstract int System.Globalization.Calendar.GetDayOfMonth ( DateTime  time)
pure virtual

◆ GetDayOfWeek()

abstract DayOfWeek System.Globalization.Calendar.GetDayOfWeek ( DateTime  time)
pure virtual

◆ GetDayOfYear()

abstract int System.Globalization.Calendar.GetDayOfYear ( DateTime  time)
pure virtual

◆ GetDaysInMonth() [1/2]

virtual int System.Globalization.Calendar.GetDaysInMonth ( int  year,
int  month 
)
virtual

Returns the number of days in the specified month and year of the current era.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
Returns
The number of days in the specified month in the specified year in the current era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.

Definition at line 394 of file Calendar.cs.

◆ GetDaysInMonth() [2/2]

abstract int System.Globalization.Calendar.GetDaysInMonth ( int  year,
int  month,
int  era 
)
pure virtual

When overridden in a derived class, returns the number of days in the specified month, year, and era.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
eraAn integer that represents the era.
Returns
The number of days in the specified month in the specified year in the specified era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.PersianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ GetDaysInYear() [1/2]

virtual int System.Globalization.Calendar.GetDaysInYear ( int  year)
virtual

Returns the number of days in the specified year of the current era.

Parameters
yearAn integer that represents the year.
Returns
The number of days in the specified year in the current era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.

Definition at line 417 of file Calendar.cs.

◆ GetDaysInYear() [2/2]

abstract int System.Globalization.Calendar.GetDaysInYear ( int  year,
int  era 
)
pure virtual

When overridden in a derived class, returns the number of days in the specified year and era.

Parameters
yearAn integer that represents the year.
eraAn integer that represents the era.
Returns
The number of days in the specified year in the specified era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ GetEra()

◆ GetHour()

virtual int System.Globalization.Calendar.GetHour ( DateTime  time)
virtual

Returns the hours value in the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 0 to 23 that represents the hour in time .

Definition at line 442 of file Calendar.cs.

◆ GetLeapMonth() [1/2]

virtual int System.Globalization.Calendar.GetLeapMonth ( int  year)
virtual

Calculates the leap month for a specified year.

Parameters
yearA year.
Returns
A positive integer that indicates the leap month in the specified year.-or-Zero if this calendar does not support a leap month or if the year parameter does not represent a leap year.

Definition at line 647 of file Calendar.cs.

◆ GetLeapMonth() [2/2]

virtual int System.Globalization.Calendar.GetLeapMonth ( int  year,
int  era 
)
virtual

Calculates the leap month for a specified year and era.

Parameters
yearA year.
eraAn era.
Returns
A positive integer that indicates the leap month in the specified year and era.-or-Zero if this calendar does not support a leap month or if the year and era parameters do not specify a leap year.

Reimplemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

Definition at line 658 of file Calendar.cs.

◆ GetMilliseconds()

virtual double System.Globalization.Calendar.GetMilliseconds ( DateTime  time)
virtual

Returns the milliseconds value in the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to read.
Returns
A double-precision floating-point number from 0 to 999 that represents the milliseconds in the time parameter.

Definition at line 451 of file Calendar.cs.

◆ GetMinute()

virtual int System.Globalization.Calendar.GetMinute ( DateTime  time)
virtual

Returns the minutes value in the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 0 to 59 that represents the minutes in time .

Definition at line 460 of file Calendar.cs.

◆ GetMonth()

◆ GetMonthsInYear() [1/2]

virtual int System.Globalization.Calendar.GetMonthsInYear ( int  year)
virtual

Returns the number of months in the specified year in the current era.

Parameters
yearAn integer that represents the year.
Returns
The number of months in the specified year in the current era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.

Definition at line 477 of file Calendar.cs.

◆ GetMonthsInYear() [2/2]

abstract int System.Globalization.Calendar.GetMonthsInYear ( int  year,
int  era 
)
pure virtual

When overridden in a derived class, returns the number of months in the specified year in the specified era.

Parameters
yearAn integer that represents the year.
eraAn integer that represents the era.
Returns
The number of months in the specified year in the specified era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ GetSecond()

virtual int System.Globalization.Calendar.GetSecond ( DateTime  time)
virtual

Returns the seconds value in the specified T:System.DateTime.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 0 to 59 that represents the seconds in time .

Definition at line 496 of file Calendar.cs.

◆ GetWeekOfYear()

virtual int System.Globalization.Calendar.GetWeekOfYear ( DateTime  time,
CalendarWeekRule  rule,
DayOfWeek  firstDayOfWeek 
)
virtual

Returns the week of the year that includes the date in the specified T:System.DateTime value.

Parameters
timeA date and time value.
ruleAn enumeration value that defines a calendar week.
firstDayOfWeekAn enumeration value that represents the first day of the week.
Returns
A positive integer that represents the week of the year that includes the date in the time parameter.
Exceptions
T:System.ArgumentOutOfRangeExceptiontime is earlier than P:System.Globalization.Calendar.MinSupportedDateTime or later than P:System.Globalization.Calendar.MaxSupportedDateTime.-or- firstDayOfWeek is not a valid T:System.DayOfWeek value.-or- rule is not a valid T:System.Globalization.CalendarWeekRule value.

Reimplemented in System.Globalization.JapaneseCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

Definition at line 560 of file Calendar.cs.

◆ GetYear()

◆ IsLeapDay() [1/2]

virtual bool System.Globalization.Calendar.IsLeapDay ( int  year,
int  month,
int  day 
)
virtual

Determines whether the specified date in the current era is a leap day.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
dayA positive integer that represents the day.
Returns
true if the specified day is a leap day; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.-or- day is outside the range supported by the calendar.

Definition at line 596 of file Calendar.cs.

◆ IsLeapDay() [2/2]

abstract bool System.Globalization.Calendar.IsLeapDay ( int  year,
int  month,
int  day,
int  era 
)
pure virtual

When overridden in a derived class, determines whether the specified date in the specified era is a leap day.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
dayA positive integer that represents the day.
eraAn integer that represents the era.
Returns
true if the specified day is a leap day; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.-or- day is outside the range supported by the calendar.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ IsLeapMonth() [1/2]

virtual bool System.Globalization.Calendar.IsLeapMonth ( int  year,
int  month 
)
virtual

Determines whether the specified month in the specified year in the current era is a leap month.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
Returns
true if the specified month is a leap month; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.

Definition at line 625 of file Calendar.cs.

◆ IsLeapMonth() [2/2]

abstract bool System.Globalization.Calendar.IsLeapMonth ( int  year,
int  month,
int  era 
)
pure virtual

When overridden in a derived class, determines whether the specified month in the specified year in the specified era is a leap month.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
eraAn integer that represents the era.
Returns
true if the specified month is a leap month; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ IsLeapYear() [1/2]

virtual bool System.Globalization.Calendar.IsLeapYear ( int  year)
virtual

Determines whether the specified year in the current era is a leap year.

Parameters
yearAn integer that represents the year.
Returns
true if the specified year is a leap year; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.

Definition at line 682 of file Calendar.cs.

◆ IsLeapYear() [2/2]

abstract bool System.Globalization.Calendar.IsLeapYear ( int  year,
int  era 
)
pure virtual

When overridden in a derived class, determines whether the specified year in the specified era is a leap year.

Parameters
yearAn integer that represents the year.
eraAn integer that represents the era.
Returns
true if the specified year is a leap year; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ ReadOnly()

static Calendar System.Globalization.Calendar.ReadOnly ( Calendar  calendar)
static

Returns a read-only version of the specified T:System.Globalization.Calendar object.

Parameters
calendarA T:System.Globalization.Calendar object.
Returns
The T:System.Globalization.Calendar object specified by the calendar parameter, if calendar is read-only.-or-A read-only memberwise clone of the T:System.Globalization.Calendar object specified by calendar , if calendar is not read-only.
Exceptions
T:System.ArgumentNullExceptioncalendar is null.

Definition at line 221 of file Calendar.cs.

◆ ToDateTime() [1/2]

virtual DateTime System.Globalization.Calendar.ToDateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond 
)
virtual

Returns a T:System.DateTime that is set to the specified date and time in the current era.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
dayA positive integer that represents the day.
hourAn integer from 0 to 23 that represents the hour.
minuteAn integer from 0 to 59 that represents the minute.
secondAn integer from 0 to 59 that represents the second.
millisecondAn integer from 0 to 999 that represents the millisecond.
Returns
The T:System.DateTime that is set to the specified date and time in the current era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.-or- day is outside the range supported by the calendar.-or- hour is less than zero or greater than 23.-or- minute is less than zero or greater than 59.-or- second is less than zero or greater than 59.-or- millisecond is less than zero or greater than 999.

Definition at line 716 of file Calendar.cs.

◆ ToDateTime() [2/2]

abstract DateTime System.Globalization.Calendar.ToDateTime ( int  year,
int  month,
int  day,
int  hour,
int  minute,
int  second,
int  millisecond,
int  era 
)
pure virtual

When overridden in a derived class, returns a T:System.DateTime that is set to the specified date and time in the specified era.

Parameters
yearAn integer that represents the year.
monthA positive integer that represents the month.
dayA positive integer that represents the day.
hourAn integer from 0 to 23 that represents the hour.
minuteAn integer from 0 to 59 that represents the minute.
secondAn integer from 0 to 59 that represents the second.
millisecondAn integer from 0 to 999 that represents the millisecond.
eraAn integer that represents the era.
Returns
The T:System.DateTime that is set to the specified date and time in the current era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.-or- month is outside the range supported by the calendar.-or- day is outside the range supported by the calendar.-or- hour is less than zero or greater than 23.-or- minute is less than zero or greater than 59.-or- second is less than zero or greater than 59.-or- millisecond is less than zero or greater than 999.-or- era is outside the range supported by the calendar.

Implemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

◆ ToFourDigitYear()

virtual int System.Globalization.Calendar.ToFourDigitYear ( int  year)
virtual

Converts the specified year to a four-digit year by using the P:System.Globalization.Calendar.TwoDigitYearMax property to determine the appropriate century.

Parameters
yearA two-digit or four-digit integer that represents the year to convert.
Returns
An integer that contains the four-digit representation of year .
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is outside the range supported by the calendar.

Reimplemented in System.Globalization.HebrewCalendar, System.Globalization.UmAlQuraCalendar, System.Globalization.EastAsianLunisolarCalendar, System.Globalization.HijriCalendar, System.Globalization.GregorianCalendar, System.Globalization.JulianCalendar, System.Globalization.PersianCalendar, System.Globalization.JapaneseCalendar, System.Globalization.TaiwanCalendar, System.Globalization.KoreanCalendar, and System.Globalization.ThaiBuddhistCalendar.

Definition at line 790 of file Calendar.cs.

Member Data Documentation

◆ CurrentEra

const int System.Globalization.Calendar.CurrentEra = 0

Represents the current era of the current calendar.

Definition at line 96 of file Calendar.cs.

◆ DaysInYearBeforeMinSupportedYear

virtual int System.Globalization.Calendar.DaysInYearBeforeMinSupportedYear => 365
protected

Gets the number of days in the year that precedes the year that is specified by the P:System.Globalization.Calendar.MinSupportedDateTime property.

Returns
The number of days in the year that precedes the year specified by P:System.Globalization.Calendar.MinSupportedDateTime.

Definition at line 178 of file Calendar.cs.

Property Documentation

◆ AlgorithmType

virtual CalendarAlgorithmType System.Globalization.Calendar.AlgorithmType
get

Gets a value indicating whether the current calendar is solar-based, lunar-based, or a combination of both.

Returns
One of the T:System.Globalization.CalendarAlgorithmType values.

Definition at line 134 of file Calendar.cs.

◆ Eras

abstract int [] System.Globalization.Calendar.Eras
get

When overridden in a derived class, gets the list of eras in the current calendar.

Returns
An array of integers that represents the eras in the current calendar.

Definition at line 171 of file Calendar.cs.

◆ IsReadOnly

bool System.Globalization.Calendar.IsReadOnly
get

Gets a value indicating whether this T:System.Globalization.Calendar object is read-only.

Returns
true if this T:System.Globalization.Calendar object is read-only; otherwise, false.

Definition at line 147 of file Calendar.cs.

◆ MaxSupportedDateTime

virtual DateTime System.Globalization.Calendar.MaxSupportedDateTime
get

Gets the latest date and time supported by this T:System.Globalization.Calendar object.

Returns
The latest date and time supported by this calendar. The default is F:System.DateTime.MaxValue.

Definition at line 118 of file Calendar.cs.

◆ MinSupportedDateTime

virtual DateTime System.Globalization.Calendar.MinSupportedDateTime
get

Gets the earliest date and time supported by this T:System.Globalization.Calendar object.

Returns
The earliest date and time supported by this calendar. The default is F:System.DateTime.MinValue.

Definition at line 105 of file Calendar.cs.

◆ TwoDigitYearMax

virtual int System.Globalization.Calendar.TwoDigitYearMax
getset

Gets or sets the last year of a 100-year range that can be represented by a 2-digit year.

Returns
The last year of a 100-year range that can be represented by a 2-digit year.
Exceptions
T:System.InvalidOperationExceptionThe current T:System.Globalization.Calendar object is read-only.

Definition at line 185 of file Calendar.cs.


The documentation for this class was generated from the following file: