TimeZoneInfo.TransitionTime TimeZoneInfo.TransitionTime TimeZoneInfo.TransitionTime TimeZoneInfo.TransitionTime Struct

定义

提供有关特定时区中特定时间更改(例如从夏时制更改为标准时间,或者从标准时间更改为夏时制)的信息。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.TransitionTimeTimeZoneInfo.TransitionTimeTimeZoneInfo.TransitionTimeTimeZoneInfo.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 Day 时间Time
固定日期规则Fixed-date rule Month 不可用N/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值,该值的日期部分被忽略; 年份、月份和日期值始终必须等于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 CreateFloatingDateRule可以通过static调用(Shared在 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.

对象的DaylightTransitionStartDaylightTransitionEnd属性返回TimeZoneInfo.TransitionTime对象。 TimeZoneInfo.AdjustmentRuleThe DaylightTransitionStart and DaylightTransitionEnd properties of an TimeZoneInfo.AdjustmentRule object return a TimeZoneInfo.TransitionTime object.

属性

Day Day Day Day

获取发生时间更改的日期。Gets the day on which the time change occurs.

DayOfWeek DayOfWeek DayOfWeek DayOfWeek

获取时间更改发生在星期几。Gets the day of the week on which the time change occurs.

IsFixedDateRule IsFixedDateRule IsFixedDateRule 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 Month Month Month

获取发生时间更改的月份。Gets the month in which the time change occurs.

TimeOfDay TimeOfDay TimeOfDay TimeOfDay

获取发生时间更改的小时、分钟和秒。Gets the hour, minute, and second at which the time change occurs.

Week Week Week Week

获取时间更改发生在月中的第几个星期。Gets the week of the month in which a time change occurs.

方法

CreateFixedDateRule(DateTime, Int32, Int32) CreateFixedDateRule(DateTime, Int32, Int32) CreateFixedDateRule(DateTime, Int32, Int32) 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) CreateFloatingDateRule(DateTime, Int32, Int32, DayOfWeek) CreateFloatingDateRule(DateTime, Int32, Int32, DayOfWeek) 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) Equals(Object) Equals(Object) Equals(Object)

确定是否一个对象具有与当前 TimeZoneInfo.TransitionTime 对象相同的值。Determines whether an object has identical values to the current TimeZoneInfo.TransitionTime object.

Equals(TimeZoneInfo+TransitionTime) Equals(TimeZoneInfo+TransitionTime) Equals(TimeZoneInfo+TransitionTime) Equals(TimeZoneInfo+TransitionTime)

确定当前 TimeZoneInfo.TransitionTime 对象是否具有与第二个 TimeZoneInfo.TransitionTime 对象相同的值。Determines whether the current TimeZoneInfo.TransitionTime object has identical values to a second TimeZoneInfo.TransitionTime object.

GetHashCode() GetHashCode() GetHashCode() GetHashCode()

用作哈希算法的哈希函数和数据结构(如哈希表)。Serves as a hash function for hashing algorithms and data structures such as hash tables.

操作员

Equality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) Equality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) Equality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) Equality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime)

确定两个指定的 TimeZoneInfo.TransitionTime 对象是否相等。Determines whether two specified TimeZoneInfo.TransitionTime objects are equal.

Inequality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) Inequality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) Inequality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime) Inequality(TimeZoneInfo+TransitionTime, TimeZoneInfo+TransitionTime)

确定两个指定的 TimeZoneInfo.TransitionTime 对象是否不相等。Determines whether two specified TimeZoneInfo.TransitionTime objects are not equal.

显式界面实现

IDeserializationCallback.OnDeserialization(Object) IDeserializationCallback.OnDeserialization(Object) IDeserializationCallback.OnDeserialization(Object) IDeserializationCallback.OnDeserialization(Object)

在对象的反序列化完成时运行。Runs when the deserialization of an object has been completed.

ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext) ISerializable.GetObjectData(SerializationInfo, StreamingContext)

使用序列化 SerializationInfo 对象所需的数据填充此对象。Populates a SerializationInfo object with the data that is required to serialize this object.

适用于