HijriCalendar.HijriAdjustment Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient ou définit le nombre de jours à ajouter ou à soustraire du calendrier afin de s’adapter aux variations de la date de début et de fin du Ramadan, ainsi qu’aux différences de dates entre les pays et régions.
public:
property int HijriAdjustment { int get(); void set(int value); };
public int HijriAdjustment { get; set; }
member this.HijriAdjustment : int with get, set
Public Property HijriAdjustment As Integer
Valeur de propriété
Entier de -2 à 2 qui représente le nombre de jours à additionner ou à soustraire du calendrier.
Exceptions
La propriété est définie sur une valeur non valide.
Exemples
L’exemple de code suivant montre comment HijriAdjustment affecte la 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.
*/
using System;
using System.Globalization;
public class SamplesHijriCalendar {
public static void Main() {
// Creates and initializes a HijriCalendar.
HijriCalendar myCal = new HijriCalendar();
// Creates a DateTime and initializes it to the second day of the first month of the year 1422.
DateTime myDT = new 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.
*/
Imports System.Globalization
Public Class SamplesHijriCalendar
Public Shared Sub Main()
' Creates and initializes a HijriCalendar.
Dim myCal As New HijriCalendar()
' Creates a DateTime and initializes it to the second day of the first month of the year 1422.
Dim myDT As New 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))
End Sub
End Class
'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.
Remarques
Cette implémentation de la HijriCalendar classe ajuste la date du calendrier en ajoutant ou en soustrayant une valeur de zéro à deux jours pour tenir compte des écarts entre le début et la fin du Ramadan et pour tenir compte de la différence de date entre les pays/régions. Cette valeur est stockée dans la HijriAdjustment propriété . Si HijriAdjustment n’est pas défini explicitement, il dérive sa valeur des paramètres dans la partie options régionales et linguistiques de Panneau de configuration et est stocké dans la valeur de Registre HKEY_CURRENT_USER\Control Panel\International\AddHijriDate. Toutefois, ces informations peuvent changer pendant la durée de vie de .AppDomain La HijriCalendar classe ne détecte pas automatiquement les modifications apportées aux paramètres système.