HijriCalendar.HijriAdjustment-Eigenschaft
Ruft die Anzahl der Tage ab (oder legt diese fest), die dem Kalender hinzugefügt bzw. von diesem abgezogen werden sollen, um die Verschiebungen von Anfang und Ende des Ramadan und die Datumsunterschiede zwischen Ländern/Regionen auszugleichen.
Namespace: System.Globalization
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
Public Property HijriAdjustment As Integer
'Usage
Dim instance As HijriCalendar
Dim value As Integer
value = instance.HijriAdjustment
instance.HijriAdjustment = value
public int HijriAdjustment { get; set; }
public:
property int HijriAdjustment {
int get ();
void set (int value);
}
/** @property */
public int get_HijriAdjustment ()
/** @property */
public void set_HijriAdjustment (int value)
public function get HijriAdjustment () : int
public function set HijriAdjustment (value : int)
Eigenschaftenwert
Eine ganze Zahl zwischen -2 und 2, die die Anzahl der Tage darstellt, die dem Kalender hinzugefügt bzw. von diesem abgezogen werden sollen.
Ausnahmen
Ausnahmetyp | Bedingung |
---|---|
Die Eigenschaft wurde auf einen ungültigen Wert festgelegt. |
Hinweise
Diese Implementierung der HijriCalendar-Klasse passt das Kalenderdatum durch Addieren oder Subtrahieren eines Werts zwischen 0 und zwei Tagen an, um die Verschiebungen von Anfang und Ende des Ramadan und die Datumsunterschiede zwischen verschiedenen Ländern und Regionen auszugleichen. Dieser Wert ist in der HijriAdjustment-Eigenschaft gespeichert. Wenn HijriAdjustment nicht explizit festgelegt wird, wird der zugehörige Wert aus den Einstellungen in Regions- und Sprachoptionen (oder Ländereinstellungen bzw. Gebietsschema) in der Windows-Systemsteuerung abgeleitet und im Registrierungswert HKEY_CURRENT_USER\Control Panel\International\AddHijriDate gespeichert. Diese Informationen können sich jedoch während der Lebensdauer der AppDomain ändern. Die HijriCalendar-Klasse erkennt Änderungen der Systemeinstellungen nicht automatisch.
Beispiel
Im folgenden Codebeispiel werden die Auswirkungen von HijriAdjustment auf das Datum angezeigt.
Imports System
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 'Main
End Class 'SamplesHijriCalendar
'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.
*/
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.
*/
import System.* ;
import System.Globalization.* ;
public class SamplesHijriCalendar
{
public static void main(String[] args)
{
// 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}.",
System.Convert.ToString(myCal.get_HijriAdjustment()));
Console.WriteLine(" Year is {0}.",
System.Convert.ToString(myCal.GetYear(myDT)));
Console.WriteLine(" Month is {0}.",
System.Convert.ToString(myCal.GetMonth(myDT)));
Console.WriteLine(" Day is {0}.",
System.Convert.ToString(myCal.GetDayOfMonth(myDT)));
// Sets the HijriAdjustment property to 2.
myCal.set_HijriAdjustment(2);
Console.WriteLine("HijriAdjustment is {0}.",
System.Convert.ToString(myCal.get_HijriAdjustment()));
Console.WriteLine(" Year is {0}.",
System.Convert.ToString(myCal.GetYear(myDT)));
Console.WriteLine(" Month is {0}.",
System.Convert.ToString(myCal.GetMonth(myDT)));
Console.WriteLine(" Day is {0}.",
System.Convert.ToString(myCal.GetDayOfMonth(myDT)));
// Sets the HijriAdjustment property to -2.
myCal.set_HijriAdjustment(-2);
Console.WriteLine("HijriAdjustment is {0}.",
System.Convert.ToString(myCal.get_HijriAdjustment()));
Console.WriteLine(" Year is {0}.",
System.Convert.ToString(myCal.GetYear(myDT)));
Console.WriteLine(" Month is {0}.",
System.Convert.ToString(myCal.GetMonth(myDT)));
Console.WriteLine(" Day is {0}.",
System.Convert.ToString(myCal.GetDayOfMonth(myDT)));
} //main
} //SamplesHijriCalendar
/*
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.
*/
Plattformen
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1
Siehe auch
Referenz
HijriCalendar-Klasse
HijriCalendar-Member
System.Globalization-Namespace