[Serializable] |
In every 30-year cycle that ends with a year that is evenly divisible by 30, the 2nd, 5th, 7th, 10th, 13th, 16th, 18th, 21st, 24th, 26th, and 29th years are leap years. A common year has 354 days and a leap year has 355 days.
The Hijri calendar has 12 months with 29 to 30 days each:
GetMonth value | Month | Days in common years | Days in leap years |
---|---|---|---|
1 | محرم (Muharram) | 30 | 30 |
2 | صفر (Safar) | 29 | 29 |
3 | ربيع الاول (Rabi I) | 30 | 30 |
4 | ربيع الثاني (Rabi II) | 29 | 29 |
5 | جمادى الاولى (Jumada I) | 30 | 30 |
6 | جمادى الثانية (Jumada II) | 29 | 29 |
7 | رجب (Rajab) | 30 | 30 |
8 | شعبان (Shaban) | 29 | 29 |
9 | رمضان (Ramadan) | 30 | 30 |
10 | شوال (Shawwal) | 29 | 29 |
11 | ذو القعدة (Zulkadah) | 30 | 30 |
12 | ذو الحجة (Zulhijjah) | 29 | 30 |
Ramadan, the month of fasting in the Muslim world, officially starts and ends according to a decree that is based on the observation of the new moon; therefore,the number of days in Shaban and the number of days in Ramadan vary.
The date January 1, 2001 A.D. in the Gregorian calendar is roughly equivalent to the sixth day of Shawwal in the year 1421 A.H. in the Hijri calendar.
This implementation of the HijriCalendar class adjusts the calendar date by adding or subtracting a value from zero to two days to accommodate the variances in the start and the end of Ramadan and to accommodate the date difference between countries. That value is derived from the settings in Regional and Language Options (or Regional Options or Regional Settings) in Control Panel in Windows and is stored in the registry value HKEY_CURRENT_USER\Control Panel\International\AddHijriDate. However, that information can change during the life of the AppDomain. The HijriCalendar class does not detect changes in the system settings automatically.
ctor #1 | Default constructor. This constructor is called by derived class constructors to initialize state in this type. Initializes a new instance of the HijriCalendar class. |
HijriEra | Represents the current era. This field is constant. |
Eras | Read-only Overridden: Gets the list of eras in the HijriCalendar. |
TwoDigitYearMax | Read-write Overridden: Gets or sets the last year of a 100-year range that can be represented by a 2-digit year. |
AddDays (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddDays Returns a DateTime that is the specified number of days away from the specified DateTime. |
AddHours (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddHours Returns a DateTime that is the specified number of hours away from the specified DateTime. |
AddMilliseconds (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddMilliseconds Returns a DateTime that is the specified number of milliseconds away from the specified DateTime. |
AddMinutes (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddMinutes Returns a DateTime that is the specified number of minutes away from the specified DateTime. |
AddMonths | Overridden: Returns a DateTime that is the specified number of months away from the specified DateTime. |
AddSeconds (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddSeconds Returns a DateTime that is the specified number of seconds away from the specified DateTime. |
AddWeeks (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.AddWeeks Returns a DateTime that is the specified number of weeks away from the specified DateTime. |
AddYears | Overridden: Returns a DateTime that is the specified number of years away from the specified DateTime. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
GetDayOfMonth | Overridden: Returns the day of the month in the specified DateTime. |
GetDayOfWeek | Overridden: Returns the day of the week in the specified DateTime. |
GetDayOfYear | Overridden: Returns the day of the year in the specified DateTime. |
GetDaysInMonth (inherited from System.Globalization.Calendar) |
Overloaded:GetDaysInMonth(int year, int month) See base class member description: System.Globalization.Calendar.GetDaysInMonthReturns the number of days in the specified month in the specified year in the current era. |
GetDaysInMonth | Overloaded:GetDaysInMonth(int year, int month, int era) Overridden: Returns the number of days in the specified month in the specified year in the specified era. |
GetDaysInYear (inherited from System.Globalization.Calendar) |
Overloaded:GetDaysInYear(int year) See base class member description: System.Globalization.Calendar.GetDaysInYearReturns the number of days in the specified year in the current era. |
GetDaysInYear | Overloaded:GetDaysInYear(int year, int era) Overridden: Returns the number of days in the specified year in the specified era. |
GetEra | Overridden: Returns the era in the specified DateTime. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetHour (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetHour Returns the hours value in the specified DateTime. |
GetMilliseconds (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetMilliseconds Returns the milliseconds value in the specified DateTime. |
GetMinute (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetMinute Returns the minutes value in the specified DateTime. |
GetMonth | Overridden: Returns the month in the specified DateTime. |
GetMonthsInYear (inherited from System.Globalization.Calendar) |
Overloaded:GetMonthsInYear(int year) See base class member description: System.Globalization.Calendar.GetMonthsInYearReturns the number of months in the specified year in the current era. |
GetMonthsInYear | Overloaded:GetMonthsInYear(int year, int era) Overridden: Returns the number of months in the specified year in the specified era. |
GetSecond (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetSecond Returns the seconds value in the specified DateTime. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
GetWeekOfYear (inherited from System.Globalization.Calendar) |
See base class member description: System.Globalization.Calendar.GetWeekOfYear Returns the week of the year that includes the date in the specified DateTime. |
GetYear | Overridden: Returns the year in the specified DateTime. |
IsLeapDay (inherited from System.Globalization.Calendar) |
Overloaded:IsLeapDay(int year, int month, int day) See base class member description: System.Globalization.Calendar.IsLeapDayDetermines whether the specified date in the current era is a leap day. |
IsLeapDay | Overloaded:IsLeapDay(int year, int month, int day, int era) Overridden: Determines whether the specified date in the specified era is a leap day. |
IsLeapMonth (inherited from System.Globalization.Calendar) |
Overloaded:IsLeapMonth(int year, int month) See base class member description: System.Globalization.Calendar.IsLeapMonthDetermines whether the specified month in the specified year in the current era is a leap month. |
IsLeapMonth | Overloaded:IsLeapMonth(int year, int month, int era) Overridden: Determines whether the specified month in the specified year in the specified era is a leap month. |
IsLeapYear (inherited from System.Globalization.Calendar) |
Overloaded:IsLeapYear(int year) See base class member description: System.Globalization.Calendar.IsLeapYearDetermines whether the specified year in the current era is a leap year. |
IsLeapYear | Overloaded:IsLeapYear(int year, int era) Overridden: Determines whether the specified year in the specified era is a leap year. |
ToDateTime (inherited from System.Globalization.Calendar) |
Overloaded:ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond) See base class member description: System.Globalization.Calendar.ToDateTimeReturns a DateTime that is set to the specified date and time in the current era. |
ToDateTime | Overloaded:ToDateTime(int year, int month, int day, int hour, int minute, int second, int millisecond, int era) Overridden: Returns a DateTime that is set to the specified date and time in the specified era. |
ToFourDigitYear | Overridden: Converts the specified two-digit year to a four-digit year by using the HijriCalendar.TwoDigitYearMax property to determine the appropriate century. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Hierarchy:
public HijriCalendar(); |
public static readonly int HijriEra;
|
public override int[] Eras {get;}
|
public override int TwoDigitYearMax {get; set;}
|
The initial value of this property is derived from the settings in Regional and Language Options (or Regional Options or Regional Settings) in Control Panel in Windows. However, that information can change during the life of the AppDomain. The HijriCalendar class does not detect changes in the system settings automatically.
time
days
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
hours
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
milliseconds
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
minutes
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
months
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
ArgumentOutOfRangeException | months is less than -120000. -or- months is greater than 120000. |
For example, if the specified month is Zulkadah, which has 30 days, the specified day is the 30th day of that month, and the value of the months parameter is 3, the resulting year is one more than the specified year, the resulting month is Safar, and the resulting day is the 29th day, which is the last day in Safar.
If the value of the months parameter is negative, the resulting DateTime is earlier than the specified DateTime.
time
seconds
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
time
weeks
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
In all .NET Framework classes derived from the Calendar class, a week is defined as seven days, except the first and last weeks of the year which might have less than seven days.
time
years
Exception Type | Condition |
---|---|
ArgumentException | The resulting DateTime is outside the supported range. |
For example, Zulhijjah has 29 days, except during leap years when it has 30 days. If the specified date is the 30th day of Zulhijjah in a leap year and the value of years is 1, the resulting date will be the 29th day of Zulhijjah in the following year.
If years is negative, the resulting DateTime is earlier than the specified DateTime.
~HijriCalendar(); |
time
time
DayOfWeek value | which indicates |
---|---|
Sunday | الاحد (Al-Ahad) |
Monday | الاثنين (Al-Ithnayn) |
Tuesday | الثلاثاء (At-Thulaathaa') |
Wednesday | الاربعاء (Al-Arbi'aa') |
Thursday | الخميس (Al-Khamiis) |
Friday | الجمعة (Al-Jumu'ah) |
Saturday | السبت (As-Sabt) |
time
year
month
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. |
year
month
era
Exception Type | Condition |
---|---|
ArgumentException | year 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. |
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
year
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
time
public virtual int GetHashCode(); |
time
time
time
time
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
year
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
time
public Type GetType(); |
public virtual int GetWeekOfYear( |
time
rule
firstDayOfWeek
Exception Type | Condition |
---|---|
ArgumentOutOfRangeException | firstDayOfWeek is outside the range supported by the calendar. -or- rule is not a valid CalendarWeekRule value. |
DateTimeFormatInfo.CalendarWeekRule of CultureInfo.DateTimeFormat contains the default CalendarWeekRule value that defines a calendar week for a specific culture.
This method can also be used to determine the number of weeks in the year by setting time to the last day of the year.
time
year
month
day
Exception Type | Condition |
---|---|
ArgumentException | year 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. |
A leap day is a day that occurs only in a leap year. For example, in the Gregorian calendar, the 29th day of February is the only leap day.
year
month
day
era
Exception Type | Condition |
---|---|
ArgumentException | year 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. |
A leap day is a day that occurs only in a leap year. In the Hijri calendar, the 30th day of Zulhijjah is the only leap day.
year
month
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- month is outside the range supported by the calendar. |
A leap month is an entire month that occurs only in a leap year. For example, in the Hebrew calendar, Veadar is the only leap month.
year
month
era
Exception Type | Condition |
---|---|
ArgumentException | year 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. |
A leap month is an entire month that occurs only in a leap year. The Hijri calendar does not have any leap months.
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
year
era
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. -or- era is outside the range supported by the calendar. |
protected object MemberwiseClone(); |
public virtual DateTime ToDateTime( |
year
month
day
hour
minute
second
millisecond
Exception Type | Condition |
---|---|
ArgumentException | year 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. |
public override DateTime ToDateTime( |
year
month
day
hour
minute
second
millisecond
era
Exception Type | Condition |
---|---|
ArgumentException | year 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. |
year
Exception Type | Condition |
---|---|
ArgumentException | year is outside the range supported by the calendar. |
public virtual string ToString(); |