TimeZoneInfo::TransitionTime::CreateFloatingDateRule Method
Defines a time change that uses a floating-date rule.
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.
- month
- Type: System::Int32
The month in which the time change occurs.
- week
- Type: System::Int32
The week of the month in which the time change occurs.
- dayOfWeek
- Type: System::DayOfWeek
The day of the week on which the time change occurs.
| 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.
The following table indicates how the parameters of the CreateFloatingDateRule method correspond to the properties of the TimeZoneInfo::TransitionTime object.
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.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.