mscorlib(4.0.0.0) API with additions
System.Globalization.PersianCalendar Class Reference

Represents the Persian calendar. More...

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

Public Member Functions

override DateTime AddMonths (DateTime time, int months)
 Returns a T:System.DateTime object that is offset the specified number of months from the specified T:System.DateTime object. More...
 
override DateTime AddYears (DateTime time, int years)
 Returns a T:System.DateTime object that is offset the specified number of years from the specified T:System.DateTime object. More...
 
override int GetDayOfMonth (DateTime time)
 Returns the day of the month in the specified T:System.DateTime object. More...
 
override DayOfWeek GetDayOfWeek (DateTime time)
 Returns the day of the week in the specified T:System.DateTime object. More...
 
override int GetDayOfYear (DateTime time)
 Returns the day of the year in the specified T:System.DateTime object. More...
 
override int GetDaysInMonth (int year, int month, int era)
 Returns the number of days in the specified month of the specified year and era. More...
 
override int GetDaysInYear (int year, int era)
 Returns the number of days in the specified year of the specified era. More...
 
override int GetEra (DateTime time)
 Returns the era in the specified T:System.DateTime object. More...
 
override int GetMonth (DateTime time)
 Returns the month in the specified T:System.DateTime object. More...
 
override int GetMonthsInYear (int year, int era)
 Returns the number of months in the specified year of the specified era. More...
 
override int GetYear (DateTime time)
 Returns the year in the specified T:System.DateTime object. More...
 
override bool IsLeapDay (int year, int month, int day, int era)
 Determines whether the specified date is a leap day. More...
 
override int GetLeapMonth (int year, int era)
 Returns the leap month for a specified year and era. More...
 
override bool IsLeapMonth (int year, int month, int era)
 Determines whether the specified month in the specified year and era is a leap month. More...
 
override bool IsLeapYear (int year, int era)
 Determines whether the specified year in the specified era is a leap year. More...
 
override DateTime ToDateTime (int year, int month, int day, int hour, int minute, int second, int millisecond, int era)
 Returns a T:System.DateTime object that is set to the specified date, time, and era. More...
 
override int ToFourDigitYear (int year)
 Converts the specified year to a four-digit year representation. More...
 
- Public Member Functions inherited from System.Globalization.Calendar
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...
 
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...
 
virtual int GetDaysInMonth (int year, int month)
 Returns the number of days in the specified month and year of the current era. More...
 
virtual int GetDaysInYear (int year)
 Returns the number of days in the specified year of the current era. 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...
 
virtual int GetMonthsInYear (int year)
 Returns the number of months in the specified year in the current 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...
 
virtual bool IsLeapDay (int year, int month, int day)
 Determines whether the specified date in the current 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...
 
virtual int GetLeapMonth (int year)
 Calculates the leap month for a specified year. More...
 
virtual bool IsLeapYear (int year)
 Determines whether the specified year in the current 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...
 

Public Attributes

override DateTime MinSupportedDateTime => minDate
 Gets the earliest date and time supported by the T:System.Globalization.PersianCalendar class. More...
 
override DateTime MaxSupportedDateTime => maxDate
 Gets the latest date and time supported by the T:System.Globalization.PersianCalendar class. More...
 
override CalendarAlgorithmType AlgorithmType => CalendarAlgorithmType.SolarCalendar
 Gets a value indicating whether the current calendar is solar-based, lunar-based, or lunisolar-based. More...
 
override int [] Eras
 Gets the list of eras in a T:System.Globalization.PersianCalendar object. More...
 
- Public Attributes inherited from System.Globalization.Calendar
const int CurrentEra = 0
 Represents the current era of the current calendar. More...
 

Static Public Attributes

static readonly int PersianEra = 1
 Represents the current era. This field is constant. More...
 

Properties

override 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...
 
- Properties inherited from System.Globalization.Calendar
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...
 

Additional Inherited Members

- Static Public Member Functions inherited from System.Globalization.Calendar
static Calendar ReadOnly (Calendar calendar)
 Returns a read-only version of the specified T:System.Globalization.Calendar object. More...
 
- Protected Member Functions inherited from System.Globalization.Calendar
 Calendar ()
 Initializes a new instance of the T:System.Globalization.Calendar class. More...
 
- Protected Attributes inherited from System.Globalization.Calendar
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...
 

Detailed Description

Represents the Persian calendar.

Definition at line 5 of file PersianCalendar.cs.

Member Function Documentation

◆ AddMonths()

override DateTime System.Globalization.PersianCalendar.AddMonths ( DateTime  time,
int  months 
)
virtual

Returns a T:System.DateTime object that is offset the specified number of months from the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to which to add months.
monthsThe positive or negative number of months to add.
Returns
A T:System.DateTime object that represents the date yielded by adding the number of months specified by the months parameter to the date specified by the time parameter.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range.
T:System.ArgumentOutOfRangeExceptionmonths is less than -120,000 or greater than 120,000.

Implements System.Globalization.Calendar.

Definition at line 201 of file PersianCalendar.cs.

◆ AddYears()

override DateTime System.Globalization.PersianCalendar.AddYears ( DateTime  time,
int  years 
)
virtual

Returns a T:System.DateTime object that is offset the specified number of years from the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to which to add years.
yearsThe positive or negative number of years to add.
Returns
The T:System.DateTime object that results from adding the specified number of years to the specified T:System.DateTime object.
Exceptions
T:System.ArgumentExceptionThe resulting T:System.DateTime is outside the supported range.
T:System.ArgumentOutOfRangeExceptionyears is less than -10,000 or greater than 10,000.

Implements System.Globalization.Calendar.

Definition at line 238 of file PersianCalendar.cs.

◆ GetDayOfMonth()

override int System.Globalization.PersianCalendar.GetDayOfMonth ( DateTime  time)
virtual

Returns the day of the month in the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 1 through 31 that represents the day of the month in the specified T:System.DateTime object.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe time parameter represents a date less than P:System.Globalization.PersianCalendar.MinSupportedDateTime or greater than P:System.Globalization.PersianCalendar.MaxSupportedDateTime.

Implements System.Globalization.Calendar.

Definition at line 247 of file PersianCalendar.cs.

◆ GetDayOfWeek()

override DayOfWeek System.Globalization.PersianCalendar.GetDayOfWeek ( DateTime  time)
virtual

Returns the day of the week in the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to read.
Returns
A T:System.DayOfWeek value that represents the day of the week in the specified T:System.DateTime object.

Implements System.Globalization.Calendar.

Definition at line 255 of file PersianCalendar.cs.

◆ GetDayOfYear()

override int System.Globalization.PersianCalendar.GetDayOfYear ( DateTime  time)
virtual

Returns the day of the year in the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 1 through 366 that represents the day of the year in the specified T:System.DateTime object.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe time parameter represents a date less than P:System.Globalization.PersianCalendar.MinSupportedDateTime or greater than P:System.Globalization.PersianCalendar.MaxSupportedDateTime.

Implements System.Globalization.Calendar.

Definition at line 264 of file PersianCalendar.cs.

◆ GetDaysInMonth()

override int System.Globalization.PersianCalendar.GetDaysInMonth ( int  year,
int  month,
int  era 
)
virtual

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

Parameters
yearAn integer from 1 through 9378 that represents the year.
monthAn integer that represents the month, and ranges from 1 through 12 if year is not 9378, or 1 through 10 if year is 9378.
eraAn integer from 0 through 1 that represents the era.
Returns
The number of days in the specified month of the specified year and era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear , month , or era is outside the range supported by this calendar.

Implements System.Globalization.Calendar.

Definition at line 276 of file PersianCalendar.cs.

◆ GetDaysInYear()

override int System.Globalization.PersianCalendar.GetDaysInYear ( int  year,
int  era 
)
virtual

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

Parameters
yearAn integer from 1 through 9378 that represents the year.
eraAn integer from 0 through 1 that represents the era.
Returns
The number of days in the specified year and era. The number of days is 365 in a common year or 366 in a leap year.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear or era is outside the range supported by this calendar.

Implements System.Globalization.Calendar.

Definition at line 297 of file PersianCalendar.cs.

◆ GetEra()

override int System.Globalization.PersianCalendar.GetEra ( DateTime  time)
virtual

Returns the era in the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to read.
Returns
Always returns F:System.Globalization.PersianCalendar.PersianEra.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe time parameter represents a date less than P:System.Globalization.PersianCalendar.MinSupportedDateTime or greater than P:System.Globalization.PersianCalendar.MaxSupportedDateTime.

Implements System.Globalization.Calendar.

Definition at line 315 of file PersianCalendar.cs.

◆ GetLeapMonth()

override int System.Globalization.PersianCalendar.GetLeapMonth ( int  year,
int  era 
)
virtual

Returns the leap month for a specified year and era.

Parameters
yearAn integer from 1 through 9378 that represents the year to convert.
eraAn integer from 0 through 1 that represents the era.
Returns
The return value is always 0.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear or era is outside the range supported by this calendar.

Reimplemented from System.Globalization.Calendar.

Definition at line 384 of file PersianCalendar.cs.

◆ GetMonth()

override int System.Globalization.PersianCalendar.GetMonth ( DateTime  time)
virtual

Returns the month in the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 1 through 12 that represents the month in the specified T:System.DateTime object.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe time parameter represents a date less than P:System.Globalization.PersianCalendar.MinSupportedDateTime or greater than P:System.Globalization.PersianCalendar.MaxSupportedDateTime.

Implements System.Globalization.Calendar.

Definition at line 325 of file PersianCalendar.cs.

◆ GetMonthsInYear()

override int System.Globalization.PersianCalendar.GetMonthsInYear ( int  year,
int  era 
)
virtual

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

Parameters
yearAn integer from 1 through 9378 that represents the year.
eraAn integer from 0 through 1 that represents the era.
Returns
Returns 10 if the year parameter is 9378; otherwise, always returns 12.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear or era is outside the range supported by this calendar.

Implements System.Globalization.Calendar.

Definition at line 336 of file PersianCalendar.cs.

◆ GetYear()

override int System.Globalization.PersianCalendar.GetYear ( DateTime  time)
virtual

Returns the year in the specified T:System.DateTime object.

Parameters
timeThe T:System.DateTime to read.
Returns
An integer from 1 through 9378 that represents the year in the specified T:System.DateTime.
Exceptions
T:System.ArgumentOutOfRangeExceptionThe time parameter represents a date less than P:System.Globalization.PersianCalendar.MinSupportedDateTime or greater than P:System.Globalization.PersianCalendar.MaxSupportedDateTime.

Implements System.Globalization.Calendar.

Definition at line 350 of file PersianCalendar.cs.

◆ IsLeapDay()

override bool System.Globalization.PersianCalendar.IsLeapDay ( int  year,
int  month,
int  day,
int  era 
)
virtual

Determines whether the specified date is a leap day.

Parameters
yearAn integer from 1 through 9378 that represents the year.
monthAn integer that represents the month and ranges from 1 through 12 if year is not 9378, or 1 through 10 if year is 9378.
dayAn integer from 1 through 31 that represents the day.
eraAn integer from 0 through 1 that represents the era.
Returns
true if the specified day is a leap day; otherwise, false.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear , month , day , or era is outside the range supported by this calendar.

Implements System.Globalization.Calendar.

Definition at line 364 of file PersianCalendar.cs.

◆ IsLeapMonth()

override bool System.Globalization.PersianCalendar.IsLeapMonth ( int  year,
int  month,
int  era 
)
virtual

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

Parameters
yearAn integer from 1 through 9378 that represents the year.
monthAn integer that represents the month and ranges from 1 through 12 if year is not 9378, or 1 through 10 if year is 9378.
eraAn integer from 0 through 1 that represents the era.
Returns
Always returns false because the T:System.Globalization.PersianCalendar class does not support the notion of a leap month.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear , month , or era is outside the range supported by this calendar.

Implements System.Globalization.Calendar.

Definition at line 397 of file PersianCalendar.cs.

◆ IsLeapYear()

override bool System.Globalization.PersianCalendar.IsLeapYear ( int  year,
int  era 
)
virtual

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

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

Implements System.Globalization.Calendar.

Definition at line 410 of file PersianCalendar.cs.

◆ ToDateTime()

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

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

Parameters
yearAn integer from 1 through 9378 that represents the year.
monthAn integer from 1 through 12 that represents the month.
dayAn integer from 1 through 31 that represents the day.
hourAn integer from 0 through 23 that represents the hour.
minuteAn integer from 0 through 59 that represents the minute.
secondAn integer from 0 through 59 that represents the second.
millisecondAn integer from 0 through 999 that represents the millisecond.
eraAn integer from 0 through 1 that represents the era.
Returns
A T:System.DateTime object that is set to the specified date and time in the current era.
Exceptions
T:System.ArgumentOutOfRangeExceptionyear , month , day , hour , minute , second , millisecond , or era is outside the range supported by this calendar.

Implements System.Globalization.Calendar.

Definition at line 432 of file PersianCalendar.cs.

◆ ToFourDigitYear()

override int System.Globalization.PersianCalendar.ToFourDigitYear ( int  year)
virtual

Converts the specified year to a four-digit year representation.

Parameters
yearAn integer from 1 through 9378 that represents the year to convert.
Returns
An integer that contains the four-digit representation of year .
Exceptions
T:System.ArgumentOutOfRangeExceptionyear is less than 0 or greater than 9378.

Reimplemented from System.Globalization.Calendar.

Definition at line 452 of file PersianCalendar.cs.

Member Data Documentation

◆ AlgorithmType

override CalendarAlgorithmType System.Globalization.PersianCalendar.AlgorithmType => CalendarAlgorithmType.SolarCalendar

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

Returns
Always returns F:System.Globalization.CalendarAlgorithmType.SolarCalendar.

Definition at line 63 of file PersianCalendar.cs.

◆ Eras

override int [] System.Globalization.PersianCalendar.Eras
Initial value:
=> new int[1]
{
}

Gets the list of eras in a T:System.Globalization.PersianCalendar object.

Returns
An array of integers that represents the eras in a T:System.Globalization.PersianCalendar object. The array consists of a single element having a value of F:System.Globalization.PersianCalendar.PersianEra.

Definition at line 71 of file PersianCalendar.cs.

◆ MaxSupportedDateTime

override DateTime System.Globalization.PersianCalendar.MaxSupportedDateTime => maxDate

Gets the latest date and time supported by the T:System.Globalization.PersianCalendar class.

Returns
The latest date and time supported by the T:System.Globalization.PersianCalendar class. See the Remarks section for more information.

Definition at line 59 of file PersianCalendar.cs.

◆ MinSupportedDateTime

override DateTime System.Globalization.PersianCalendar.MinSupportedDateTime => minDate

Gets the earliest date and time supported by the T:System.Globalization.PersianCalendar class.

Returns
The earliest date and time supported by the T:System.Globalization.PersianCalendar class. See the Remarks section for more information.

Definition at line 55 of file PersianCalendar.cs.

◆ PersianEra

readonly int System.Globalization.PersianCalendar.PersianEra = 1
static

Represents the current era. This field is constant.

Definition at line 8 of file PersianCalendar.cs.

Property Documentation

◆ TwoDigitYearMax

override int System.Globalization.PersianCalendar.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.InvalidOperationExceptionThis calendar is read-only.
T:System.ArgumentOutOfRangeExceptionThe value in a set operation is less than 100 or greater than 9378.

Definition at line 81 of file PersianCalendar.cs.


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