TimeZone.GetDaylightChanges(Int32) 方法

定義

傳回特定年份的日光節約時期。Returns the daylight saving time period for a particular year.

public:
 abstract System::Globalization::DaylightTime ^ GetDaylightChanges(int year);
public abstract System.Globalization.DaylightTime GetDaylightChanges (int year);
abstract member GetDaylightChanges : int -> System.Globalization.DaylightTime
Public MustOverride Function GetDaylightChanges (year As Integer) As DaylightTime

參數

year
Int32

日光節約時期套用的年份。The year that the daylight saving time period applies to.

傳回

DaylightTime 物件,包含 year 中的日光節約時間開始與結束日期。A DaylightTime object that contains the start and end date for daylight saving time in year.

例外狀況

year 小於 1 或大於 9999。year is less than 1 or greater than 9999.

備註

僅支援每年一個日光節約時間週期。Only one daylight saving time period per year is supported.

如果目前的時區未使用日光節約時間, 則傳回值DaylightTime會是物件, 其中StartEnd的值TimeSpanDateTime.MinValue, 而的值DaylightTime.Delta則是初始化為0刻度。If daylight saving time is not used in the current time zone, the return value is a DaylightTime object, where the value of Start and End is DateTime.MinValue, and the value of DaylightTime.Delta is a TimeSpan initialized to 0 ticks.

給呼叫者的注意事項

因為類別僅支援一個日光節約時間調整規則GetDaylightChanges(Int32) , 所以不論調整規則是否實際套用至該年份, 方法都會將目前的調整規則套用至任何年份。 TimeZoneBecause the TimeZone class supports only one daylight saving time adjustment rule, the GetDaylightChanges(Int32) method applies the current adjustment rule to any year, regardless of whether the adjustment rule actually applies to that year. 假設作業系統本身具有特定年份的正確資料, 則使用TimeZoneInfo.AdjustmentRule GetAdjustmentRules()方法所傳回的物件陣列, 可提供更精確的結果。Assuming that the operating system itself has accurate data for a particular year, a more accurate result is available by working with the array of TimeZoneInfo.AdjustmentRule objects returned by the GetAdjustmentRules() method. Start、和End屬性會對應至DateEnd、和屬性DaylightDeltaDateStart DeltaThe Start, End, and Delta properties correspond to the DateStart, DateEnd, and DaylightDelta properties.

適用於

另請參閱