Export (0) Print
Expand All

TimeZoneInfo::GetAdjustmentRules Method

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

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

public:
array<TimeZoneInfo::AdjustmentRule^>^ GetAdjustmentRules()

Return Value

Type: array<System::TimeZoneInfo::AdjustmentRule>
An array of objects for this time zone.

ExceptionCondition
OutOfMemoryException

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

Supported in: 4.6, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft