TimeZoneInfo.TransitionTime 結構

定義

提供某時區中之特定時間變更的相關資訊,例如從日光節約時間變更為標準時間,或從標準時間變更為日光節約時間。Provides information about a specific time change, such as the change from daylight saving time to standard time or vice versa, in a particular time zone.

public: value class TimeZoneInfo::TransitionTime : IEquatable<TimeZoneInfo::TransitionTime>, System::Runtime::Serialization::IDeserializationCallback, System::Runtime::Serialization::ISerializable
[System.Serializable]
public struct TimeZoneInfo.TransitionTime : IEquatable<TimeZoneInfo.TransitionTime>, System.Runtime.Serialization.IDeserializationCallback, System.Runtime.Serialization.ISerializable
type TimeZoneInfo.TransitionTime = struct
    interface ISerializable
    interface IDeserializationCallback
Public Structure TimeZoneInfo.TransitionTime
Implements IDeserializationCallback, IEquatable(Of TimeZoneInfo.TransitionTime), ISerializable
繼承
TimeZoneInfo.TransitionTime
屬性
實作

備註

您可以使用TimeZoneInfo.TransitionTime結構來表示從標準時間轉換到日光節約時間,或從日光節約時間轉換回標準時間。You can use the TimeZoneInfo.TransitionTime structure to indicate when a transition from standard time to daylight saving time, or from daylight saving time back to standard time, occurs. 此結構同時支援固定日期規則和浮動日期規則。This structure supports both fixed-date rules and floating-date rules. 針對特定月份的特定一天發生的時間轉換使用固定日期規則(例如上午2:00Use fixed-date rules for time transitions that occur on a specific day of a specific month (such as 2:00 A.M. 于11月3日)。on November 3). 針對特定月份特定周的特定一天發生的時間轉換,使用浮動日期規則(例如上午2:00Use floating-date rules for time transitions that occur on a specific day of a specific week of a specific month (such as 2:00 A.M. 在11月的第一個星期日)。on the first Sunday of November).

下表比較固定日期和浮動日期轉換中使用的屬性:The following table compares the properties used in fixed-date and floating-date transitions:

月份Month 那個Week DayDay 時間Time
固定日期規則Fixed-date rule Month N/AN/A Day TimeOfDay
浮動日期規則Floating-date rule Month Week DayOfWeek TimeOfDay

對於固定日期和浮動日期的轉換, TimeOfDay屬性會取得發生時間變更的時間。For both fixed-date and floating-date transitions, the TimeOfDay property gets the time at which the time change occurs. 若為從標準轉換為日光節約時間,這就是時區的標準時間值。For transitions from standard to daylight saving time, this is the time zone's standard time value. 若為從日光節約轉換成標準時間,這就是時區的日光節約時間值。For transitions from daylight saving to standard time, this is the time zone's daylight saving time value. 這是已DateTime忽略其日期元件的值; 其 year、month 和 day 值必須一律等於1。This is a DateTime value whose date component is ignored; its year, month, and day value must always equal 1.

注意

TimeZoneInfo.TransitionTime結構的實例為不可變。An instance of the TimeZoneInfo.TransitionTime structure is immutable. 一旦建立物件之後,就無法修改其值。Once an object has been created, its values cannot be modified.

CreateFixedDateRule static Shared若要建立CreateFloatingDateRule物件,您可以呼叫(Visual Basic 中)和方法,分別建立固定或浮動日期規則。 TimeZoneInfo.TransitionTimeA TimeZoneInfo.TransitionTime object can be created by calling the static (Shared in Visual Basic) CreateFixedDateRule and CreateFloatingDateRule methods to create a fixed or floating-date rule, respectively. 開始和結束TimeZoneInfo.TransitionTime物件接著會當做參數提供CreateAdjustmentRule給方法,以建立新的調整規則,其中包含此轉換時間資訊。The starting and ending TimeZoneInfo.TransitionTime objects are then supplied as parameters to the CreateAdjustmentRule method to create a new adjustment rule that includes this transition time information.

物件DaylightTransitionStart的和DaylightTransitionEnd屬性會傳回物件。TimeZoneInfo.TransitionTime TimeZoneInfo.AdjustmentRuleThe DaylightTransitionStart and DaylightTransitionEnd properties of an TimeZoneInfo.AdjustmentRule object return a TimeZoneInfo.TransitionTime object.

屬性

Day

取得發生時間變更的日期。Gets the day on which the time change occurs.

DayOfWeek

取得發生時間變更的當週日次。Gets the day of the week on which the time change occurs.

IsFixedDateRule

取得值,指出時間變更發生在固定日期和時間 (例如 11 月 1 日) 或是浮動日期和時間 (例如 10 月的最後一個星期日)。Gets a value indicating whether the time change occurs at a fixed date and time (such as November 1) or a floating date and time (such as the last Sunday of October).

Month

取得發生時間變更的月份。Gets the month in which the time change occurs.

TimeOfDay

取得發生時間變更的時、分和秒。Gets the hour, minute, and second at which the time change occurs.

Week

取得發生時間變更的當月週次。Gets the week of the month in which a time change occurs.

方法

CreateFixedDateRule(DateTime, Int32, Int32)

定義使用固定日期規則的時間變更 (也就是在特定月份的特定日期發生的時間變更)。Defines a time change that uses a fixed-date rule (that is, a time change that occurs on a specific day of a specific month).

CreateFloatingDateRule(DateTime, Int32, Int32, DayOfWeek)

定義使用浮動日期規則的時間變更 (也就是在特定月份特定星期的特定日期發生的時間變更)。Defines a time change that uses a floating-date rule (that is, a time change that occurs on a specific day of a specific week of a specific month).

Equals(Object)

判斷物件的值是否與目前 TimeZoneInfo.TransitionTime 物件的值相等。Determines whether an object has identical values to the current TimeZoneInfo.TransitionTime object.

Equals(TimeZoneInfo+TransitionTime)

判斷目前 TimeZoneInfo.TransitionTime 物件的值是否與第二個 TimeZoneInfo.TransitionTime 物件的值相等。Determines whether the current TimeZoneInfo.TransitionTime object has identical values to a second TimeZoneInfo.TransitionTime object.

GetHashCode()

做為雜湊函式,用於雜湊演算法和資料結構,例如雜湊資料表。Serves as a hash function for hashing algorithms and data structures such as hash tables.

運算子

Equality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime)

判斷指定的兩個 TimeZoneInfo.TransitionTime 物件是否相等。Determines whether two specified TimeZoneInfo.TransitionTime objects are equal.

Inequality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime)

判斷指定的兩個 TimeZoneInfo.TransitionTime 物件是否相等。Determines whether two specified TimeZoneInfo.TransitionTime objects are not equal.

明確介面實作

IDeserializationCallback.OnDeserialization(Object)

在物件完成還原序列化時執行。Runs when the deserialization of an object has been completed.

ISerializable.GetObjectData(SerializationInfo, StreamingContext)

SerializationInfo 物件中填入將這個物件序列化時所需的資料。Populates a SerializationInfo object with the data that is required to serialize this object.

適用於