TimeZoneInfo.AdjustmentRule.DateStart TimeZoneInfo.AdjustmentRule.DateStart TimeZoneInfo.AdjustmentRule.DateStart TimeZoneInfo.AdjustmentRule.DateStart Property

定義

調整規則が有効になる日付を取得します。Gets the date when the adjustment rule takes effect.

public:
 property DateTime DateStart { DateTime get(); };
public DateTime DateStart { get; }
member this.DateStart : DateTime
Public ReadOnly Property DateStart As DateTime

プロパティ値

調整規則がいつ有効になるかを示す DateTime 値。A DateTime value that indicates when the adjustment rule takes effect.

次の例では、すべてのローカル コンピューターのシステム レジストリなどの開始日と終了日のそれらの調整規則で定義されているタイム ゾーンに関する情報が表示されます。The following example displays information about all of the time zones defined in the local computer's system registry, including the starting and ending dates of their adjustment rules.

using System;
using System.Collections.ObjectModel;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      ReadOnlyCollection<TimeZoneInfo> timeZones = TimeZoneInfo.GetSystemTimeZones();
      DateTimeFormatInfo dateInfo = CultureInfo.CurrentCulture.DateTimeFormat;
      
      foreach (var zone in timeZones)
      {
         Console.WriteLine("{0} transition time information:", zone.StandardName);
         Console.WriteLine("   Time zone information: ");
         Console.WriteLine("      Base UTC Offset: {0}", zone.BaseUtcOffset);
         Console.WriteLine("      Supports DST: {0}", zone.SupportsDaylightSavingTime);

         TimeZoneInfo.AdjustmentRule[] adjustmentRules= zone.GetAdjustmentRules();
         
         // Indicate that time zone has no adjustment rules
         if (adjustmentRules.Length == 0) {
            Console.WriteLine("      No adjustment rules defined.");
         }   
         else {
            Console.WriteLine("      Adjustment Rules: {0}", adjustmentRules.Length);
            // Iterate adjustment rules       
            foreach (var adjustmentRule in adjustmentRules) {
               Console.WriteLine("   Adjustment rule from {0:d} to {1:d}:", 
                                 adjustmentRule.DateStart, 
                                 adjustmentRule.DateEnd);                                 
               Console.WriteLine("      Delta: {0}", adjustmentRule.DaylightDelta);
               // Get start of transition
               TimeZoneInfo.TransitionTime daylightStart = adjustmentRule.DaylightTransitionStart;
               // Display information on floating date rule
               if (! daylightStart.IsFixedDateRule)
                  Console.WriteLine("      Begins at {0:t} on the {1} {2} of {3}", 
                                 daylightStart.TimeOfDay, 
                                 (WeekOfMonth) daylightStart.Week,  
                                 daylightStart.DayOfWeek, 
                                 dateInfo.GetMonthName(daylightStart.Month));
               // Display information on fixed date rule 
               else
                  Console.WriteLine("      Begins at {0:t} on {1} {2}", 
                                    daylightStart.TimeOfDay, 
                                    dateInfo.GetMonthName(daylightStart.Month), 
                                    daylightStart.Day);
               
               // Get end of transition.
              TimeZoneInfo.TransitionTime daylightEnd = adjustmentRule.DaylightTransitionEnd;
               // Display information on floating date rule.
               if (!daylightEnd.IsFixedDateRule) 
                  Console.WriteLine("      Ends at {0:t} on the {1} {2} of {3}", 
                                 daylightEnd.TimeOfDay, 
                                 (WeekOfMonth) daylightEnd.Week,  
                                 daylightEnd.DayOfWeek, 
                                 dateInfo.GetMonthName(daylightEnd.Month));
               // Display information on fixed date rule.
               else
                  Console.WriteLine("      Ends at {0:t} on {1} {2}", 
                                    daylightEnd.TimeOfDay, 
                                    dateInfo.GetMonthName(daylightEnd.Month), 
                                    daylightEnd.Day);
            }
         }   
      }   
   }

   private enum WeekOfMonth 
   {
      First = 1,
      Second = 2,
      Third = 3,
      Fourth = 4,
      Last = 5,
   }
}
// A portion of the output from the example might appear as follows:
//       Tonga Standard Time transition time information:
//          Time zone information:
//             Base UTC Offset: 13:00:00
//             Supports DST: False
//             No adjustment rules defined.
//       Samoa Standard Time transition time information:
//          Time zone information:
//             Base UTC Offset: 13:00:00
//             Supports DST: True
//             Adjustment Rules: 4
//          Adjustment rule from 1/1/0001 to 12/31/2009:
//             Delta: 00:00:00
//             Begins at 12:00 AM on January 1
//             Ends at 12:00 AM on January 1
//          Adjustment rule from 1/1/2010 to 12/31/2010:
//             Delta: 01:00:00
//             Begins at 11:59 PM on the Last Saturday of September
//             Ends at 12:00 AM on the First Friday of January
//          Adjustment rule from 1/1/2011 to 12/31/2011:
//             Delta: 01:00:00
//             Begins at 3:00 AM on the Fourth Saturday of September
//             Ends at 4:00 AM on the First Saturday of April
//          Adjustment rule from 1/1/2012 to 12/31/9999:
//             Delta: 01:00:00
//             Begins at 12:00 AM on the Last Sunday of September
//             Ends at 1:00 AM on the First Sunday of April
//       Line Islands Standard Time transition time information:
//          Time zone information:
//             Base UTC Offset: 14:00:00
//             Supports DST: False
//             No adjustment rules defined.
Imports System.Collections.ObjectModel
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim timeZones As ReadOnlyCollection(Of TimeZoneInfo) = TimeZoneInfo.GetSystemTimeZones()
      Dim dateInfo As DateTimeFormatInfo = CultureInfo.CurrentCulture.DateTimeFormat
      
      For Each zone In timeZones
         Console.WriteLine("{0} transition time information:", zone.StandardName)
         Console.WriteLine("   Time zone information: ")
         Console.WriteLine("      Base UTC Offset: {0}", zone.BaseUtcOffset)
         Console.WriteLine("      Supports DST: {0}", zone.SupportsDaylightSavingTime)

         Dim adjustmentRules() As TimeZoneInfo.AdjustmentRule = zone.GetAdjustmentRules()
         
         ' Indicate that time zone has no adjustment rules
         If adjustmentRules.Length = 0 Then
            Console.WriteLine("      No adjustment rules defined.")
         Else
            Console.WriteLine("      Adjustment Rules: {0}", adjustmentRules.Length)
            ' Iterate adjustment rules       
            For Each adjustmentRule In adjustmentRules
               Console.WriteLine("   Adjustment rule from {0:d} to {1:d}:", 
                                 adjustmentRule.DateStart, 
                                 adjustmentRule.DateEnd)                                 
               Console.WriteLine("      Delta: {0}", adjustmentRule.DaylightDelta)
               ' Get start of transition
               Dim daylightStart As TimeZoneInfo.TransitionTime = adjustmentRule.DaylightTransitionStart
               ' Display information on floating date rule
               If Not daylightStart.IsFixedDateRule Then
                  Console.WriteLine("      Begins at {0:t} on the {1} {2} of {3}", 
                                 daylightStart.TimeOfDay, 
                                 CType(daylightStart.Week, WeekOfMonth),  
                                 daylightStart.DayOfWeek, 
                                 dateInfo.GetMonthName(daylightStart.Month))
               ' Display information on fixed date rule 
               Else
                  Console.WriteLine("      Begins at {0:t} on {1} {2}", 
                                    daylightStart.TimeOfDay, 
                                    dateInfo.GetMonthName(daylightStart.Month), 
                                    daylightStart.Day)
               End If
               
               ' Get end of transition.
               Dim daylightEnd As TimeZoneInfo.TransitionTime = adjustmentRule.DaylightTransitionEnd
               ' Display information on floating date rule.
               If Not daylightEnd.IsFixedDateRule Then 
                  Console.WriteLine("      Ends at {0:t} on the {1} {2} of {3}", 
                                 daylightEnd.TimeOfDay, 
                                 CType(daylightEnd.Week, WeekOfMonth),  
                                 daylightEnd.DayOfWeek, 
                                 dateInfo.GetMonthName(daylightEnd.Month))
               ' Display information on fixed date rule.
               Else
                  Console.WriteLine("      Ends at {0:t} on {1} {2}", 
                                    daylightEnd.TimeOfDay, 
                                    dateInfo.GetMonthName(daylightEnd.Month), 
                                    daylightEnd.Day)
               End If
            Next
         End If   
      Next   
   End Sub

   Private Enum WeekOfMonth As Integer
      First = 1
      Second = 2
      Third = 3
      Fourth = 4
      Last = 5
   End Enum
End Module
' A portion of the output from the example might appear as follows:
'       Tonga Standard Time transition time information:
'          Time zone information:
'             Base UTC Offset: 13:00:00
'             Supports DST: False
'             No adjustment rules defined.
'       Samoa Standard Time transition time information:
'          Time zone information:
'             Base UTC Offset: 13:00:00
'             Supports DST: True
'             Adjustment Rules: 4
'          Adjustment rule from 1/1/0001 to 12/31/2009:
'             Delta: 00:00:00
'             Begins at 12:00 AM on January 1
'             Ends at 12:00 AM on January 1
'          Adjustment rule from 1/1/2010 to 12/31/2010:
'             Delta: 01:00:00
'             Begins at 11:59 PM on the Last Saturday of September
'             Ends at 12:00 AM on the First Friday of January
'          Adjustment rule from 1/1/2011 to 12/31/2011:
'             Delta: 01:00:00
'             Begins at 3:00 AM on the Fourth Saturday of September
'             Ends at 4:00 AM on the First Saturday of April
'          Adjustment rule from 1/1/2012 to 12/31/9999:
'             Delta: 01:00:00
'             Begins at 12:00 AM on the Last Sunday of September
'             Ends at 1:00 AM on the First Sunday of April
'       Line Islands Standard Time transition time information:
'          Time zone information:
'             Base UTC Offset: 14:00:00
'             Supports DST: False
'             No adjustment rules defined.

注釈

値、DateStartプロパティは、時刻部分なしの日付値。The value of the DateStart property is a date value without a time component. これで、特定の調整規則が有効になる日付を定義します。It defines the date on which a particular adjustment rule goes into effect. これは、日付を有効に一連の遷移 (通常は夏時間の期間を 1 つの遷移と標準時に 1 つの遷移によって定義されます) を参照してください。This is the date in which a set of transitions (which typically are defined by one transition to daylight savings time and one transition back to standard time) go into effect. 3 月の第 2 日曜日夏時間に移行するためと年 11 月の最初の日曜日に標準時に遷移をなどの調整規則は、2017 年 1 月 1 日で有効になる説明をします。For example, an adjustment rule might go into effect on January 1, 2017, that provides for a transition to daylight savings time on the second Sunday of March and for a transition back to standard time on the first Sunday of November. 調整規則の開始日が日付の最初の遷移に関連付けられていないことに注意してください。Note that the starting date of the adjustment rule is not tied to the date of the first transition.

割り当てることができますDateTime.MinValue.DateDateEndプロパティ タイム ゾーン対応アプリケーションで使用するためのカスタムの調整規則を作成するときに過去のタイム ゾーン情報を処理する必要はありません。You can assign DateTime.MinValue.Date to the DateEnd property when you create a custom adjustment rule for use in a time zone-aware application that does not have to work with historic time zone information.

重要

それ以外の場合は特別な理由がある場合を除き、タイム ゾーンで標準時間が適用される時間間隔内に発生する調整規則の開始日を定義する必要があります。Unless there is a compelling reason to do otherwise, you should define the adjustment rule's start date to occur within the time interval during which the time zone observes standard time. そう説得力のある理由がある場合を除き、タイム ゾーンで夏時間が適用される時間間隔内に発生する調整規則の開始日を定義しないでください。Unless there is a compelling reason to do so, you should not define the adjustment rule's start date to occur within the time interval during which the time zone observes daylight saving time. たとえば、年 3 月の第 3 日曜日に夏時間からタイム ゾーンの切り替えが発生、年 10 月の最初の日曜日に夏時間への切り替えが発生した場合、調整規則の有効開始日することはできません、特定の 1 月 1 日年、夏時間の期間内にその日付が行われるためです。For example, if a time zone's transition from daylight saving time occurs on the third Sunday of March and its transition to daylight saving time occurs on the first Sunday of October, the effective start date of the adjustment rule should not be January 1 of a particular year, since that date occurs within the period of daylight saving time.

Windows XP でレジストリを既定では、開始の日付の年 1 月 1日、月曜日 0001 単一の調整規則を定義します (値のDateTime.MinValue.Date)、各タイム ゾーン。By default, the registry in Windows XP defines a single adjustment rule whose start date is Monday, January 01, 0001 (the value of DateTime.MinValue.Date), for each time zone. 米国の州のタイム ゾーン、Windows Vista のレジストリには、2 つの調整規則が定義されます。For time zones in the United States, the registry in Windows Vista defines two adjustment rules:

  • 月曜日、1 月 1 日、0001、2006 年 12 月 31 日日曜日です。Monday, January 01, 0001, to Sunday, December 31, 2006.

  • 月曜日、01 2007 年 1 月、年 12 月 31 日の金曜日に 9999 です。Monday, January 01, 2007, to Friday, December 31, 9999.

つまり、レジストリに格納されているタイム ゾーン調整規則は現在のタイム ゾーンに関連する操作を実行する場合に便利ですが、確実には使用できませんの過去のタイム ゾーン情報を取得します。This means that, although time zone adjustment rules stored in the registry are useful for performing current time zone-related operations, they cannot be reliably used for retrieving historical time zone information. 履歴のタイム ゾーン対応アプリケーションで使用できる複数の調整規則とカスタムのタイム ゾーンを定義する方法の詳細については、次を参照してください。方法。タイム ゾーン調整規則を作成です。For information about defining a custom time zone with multiple adjustment rules that can be used in a historical time zone-aware application, see How to: Create Time Zones with Adjustment Rules.

適用対象