TimeZone.GetUtcOffset Method

Returns the Coordinated Universal Time (UTC) offset for the specified local time.

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

Syntax

public virtual abstract TimeSpan GetUtcOffset (
         DateTime time
)

Parameters

  • time
    The local date and time.

Return Value

The UTC offset from the time parameter, measured in ticks.

Remarks

Coordinated Universal Time (UTC) was previously known as Greenwich Mean Time (GMT). Local time is the date and time on the computer you are using. Offset is the difference between local time and UTC (local time = UTC + offset).

The time parameter must reflect the Gregorian calendar and the time zone represented by this TimeZone object. If time is in daylight saving time, the GetUtcOffset method returns the UTC offset to the daylight saving time zone. This method obtains the daylight saving time rule from the system.

For example, for Pacific Standard Time (in the United States), which has -8 hours of offset, the following method call returns -288000000000:

GetUtcOffset(new DateTime(1999, 1, 1))

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, 4.1, and 4.2.

See Also

Reference

TimeZone Class
TimeZone Members
System Namespace