TimeZoneInfo.GetUtcOffset Method (DateTimeOffset)


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

Calculates the offset or difference between the time in this time zone and Coordinated Universal Time (UTC) for a particular date and time.

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

member GetUtcOffset : 
        dateTimeOffset:DateTimeOffset -> TimeSpan


Type: System.DateTimeOffset

The date and time to determine the offset for.

Return Value

Type: System.TimeSpan

An object that indicates the time difference between Coordinated Universal Time (UTC) and the current time zone.

The returned time span includes any differences due to the application of adjustment rules to the current time zone. It differs from the BaseUtcOffset property, which returns the difference between Coordinated Universal Time (UTC) and the time zone's standard time and, therefore, does not take adjustment rules into account.

Notes to Callers:

On Windows XP systems, this method applies only the current adjustment rule when calculating the offset from UTC if the current instance is TimeZoneInfo.Local. As a result, the method may not accurately calculate the difference between the local time and UTC on dateTimeOffset. For more information, see the Notes for Callers section in the Local property.

Universal Windows Platform
Available since 8
.NET Framework
Available since 3.5
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top