HijriCalendar::HijriAdjustment Property
Gets or sets the number of days to add or subtract from the calendar to accommodate the variances in the start and the end of Ramadan and to accommodate the date difference between countries/regions.
Assembly: mscorlib (in mscorlib.dll)
Property Value
Type: System::Int32An integer from -2 to 2 that represents the number of days to add or subtract from the calendar.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The property is being set to an invalid value. |
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/regions. That value is stored in the HijriAdjustment property. If HijriAdjustment is not set explicitly, it derives its value from the settings in the regional and language options portion of Control Panel 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.
The following code example shows how HijriAdjustment affects the date.
using namespace System; using namespace System::Globalization; int main() { // Creates and initializes a HijriCalendar. HijriCalendar^ myCal = gcnew HijriCalendar; // Creates a DateTime and initializes it to the second day of the first month of the year 1422. DateTime myDT = DateTime(1422,1,2,myCal); // Displays the current values of the DateTime. Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); // Sets the HijriAdjustment property to 2. myCal->HijriAdjustment = 2; Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); // Sets the HijriAdjustment property to -2. myCal->HijriAdjustment = -2; Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); } /* This code produces the following output. Results vary depending on the registry settings. HijriAdjustment is 0. Year is 1422. Month is 1. Day is 2. HijriAdjustment is 2. Year is 1422. Month is 1. Day is 4. HijriAdjustment is -2. Year is 1421. Month is 12. Day is 29. */
Available since 10
.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0