TimeZoneInfo.GetAdjustmentRules Method ()


The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Retrieves an array of TimeZoneInfo.AdjustmentRule objects that apply to the current TimeZoneInfo object.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)

member GetAdjustmentRules : unit -> TimeZoneInfo.AdjustmentRule[]

Return Value

Type: System.TimeZoneInfo.AdjustmentRule[]

An array of objects for this time zone.

Exception Condition

The system does not have enough memory to make an in-memory copy of the adjustment rules.

The GetAdjustmentRules method retrieves an array of System.TimeZoneInfo.AdjustmentRule objects. Each object in the array defines the effective start and end date of that time zone adjustment, as well as its delta (the exact amount by which the adjustment causes the time to change). In addition, two properties return System.TimeZoneInfo.TransitionTime objects that define when each annual transition to and from standard time occurs.

If a time zone has multiple adjustment rules, they are generally ordered from earliest (at index 0) to latest (at index Length – 1).

If a time zone has no adjustment rules, the GetAdjustmentRules method returns an empty array (an array whose Length is zero).

Any modifications to the elements of the array returned by the GetAdjustmentRules method are not reflected in the adjustment rules that belong to a particular time zone. To modify a time zone's adjustment rules (such as to reflect its historical transition to and from daylight saving time) you must create a new time zone with the appropriate adjustment rules, rather than modify the existing one.

The following example retrieves all time zones that are defined on the local system and displays complete information about their adjustment rules to the console.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.5
Return to top