HijriCalendar.HijriAdjustment プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
ラマダンの開始と終了の差異や、国/地域ごとの日付の違いに対応するようにカレンダーに加算または減算する日数を取得または設定します。
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
プロパティ値
暦に加算または減算する日数を表す -2 ~ 2 の整数。
例外
プロパティが無効な値に設定されています。
例
次のコード例は、日付に与 HijriAdjustment える影響を示しています。
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.
注釈
クラスの HijriCalendar この実装では、ラマダンの開始日と終了日の差異に対応し、国/地域間の日付の差に対応するために、0 から 2 日間の値を加算または減算してカレンダーの日付を調整します。 この値は、 プロパティに HijriAdjustment 格納されます。 が明示的に設定されていない場合HijriAdjustmentは、コントロール パネルの地域と言語のオプションの部分の設定から値が派生し、レジストリ値 HKEY_CURRENT_USER\Control Panel\International\AddHijriDate に格納されます。 ただし、その情報は の有効期間中に変更される AppDomain可能性があります。 クラスは HijriCalendar 、システム設定の変更を自動的に検出しません。
適用対象
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET