HijriCalendar.HijriAdjustment Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene o establece el número de días que se agregarán o restarán del calendario para ajustar las variaciones del principio y del final de Ramadán y adaptar la diferencia de fechas entre los países o regiones.
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
Valor de propiedad
Un entero entre -2 y 2 que representa el número de días que se sumarán o restarán del calendario.
Excepciones
La propiedad se va a establecer en un valor no válido.
Ejemplos
En el ejemplo de código siguiente se muestra cómo HijriAdjustment afecta a la fecha.
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.
Comentarios
Esta implementación de la HijriCalendar clase ajusta la fecha del calendario agregando o restando un valor de cero a dos días para acomodar las variaciones en el inicio y el final del Ramadán y para dar cabida a la diferencia de fecha entre países o regiones. Ese valor se almacena en la HijriAdjustment propiedad . Si HijriAdjustment no se establece explícitamente, deriva su valor de la configuración de la parte de opciones regionales y de idioma de Panel de control y se almacena en el valor del Registro HKEY_CURRENT_USER\Control Panel\International\AddHijriDate. Sin embargo, esa información puede cambiar durante la vida de AppDomain. La HijriCalendar clase no detecta automáticamente los cambios en la configuración del sistema.