TimeZoneInfo::TransitionTime::CreateFloatingDateRule Method (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).
Assembly: mscorlib (in mscorlib.dll)
public: static TimeZoneInfo::TransitionTime CreateFloatingDateRule( DateTime timeOfDay, int month, int week, DayOfWeek dayOfWeek )
Parameters
- timeOfDay
-
Type:
System::DateTime
The time at which the time change occurs. This parameter corresponds to the TimeOfDay property. For details, see Remarks.
- month
-
Type:
System::Int32
The month in which the time change occurs. This parameter corresponds to the Month property.
- week
-
Type:
System::Int32
The week of the month in which the time change occurs. Its value can range from 1 to 5, with 5 representing the last week of the month. This parameter corresponds to the Week property.
- dayOfWeek
-
Type:
System::DayOfWeek
The day of the week on which the time change occurs. This parameter corresponds to the DayOfWeek property.
| Exception | Condition |
|---|---|
| ArgumentException | The timeOfDay parameter has a non-default date component. -or- The timeOfDay parameter does not represent a whole number of milliseconds. -or- The timeOfDay parameter's Kind property is not DateTimeKind::Unspecified. |
| ArgumentOutOfRangeException | month is less than 1 or greater than 12. -or- week is less than 1 or greater than 5. -or- The dayOfWeek parameter is not a member of the DayOfWeek enumeration. |
This method creates a floating-date rule (that is, a time change that occurs on a specific day of a specific week of a specific month). For example, a time change that occurs on the last Sunday of October follows a floating-date rule.
For transitions from standard time to daylight saving time, the timeOfDay argument represents the time of the transition in the time zone's standard time. For transitions from daylight saving time to standard time, it represents the time of the transition in the time zone's daylight saving time. Note that this is a DateTime value whose year, month, and date values must all equal 1.
The following example creates time zone transitions for an imaginary time zone by using both a fixed-date rule and a floating-date rule. The floating-date rule defines a time zone adjustment that starts at 2:00 A.M. on the last Sunday of March and ends at 3:00 A.M. on the fourth Sunday in October for the years 1956 onward.
Available since 3.5