Export (0) Print
Expand All

TimeZoneInfo.GetUtcOffset Method (DateTimeOffset)

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)

public TimeSpan GetUtcOffset(
	DateTimeOffset dateTimeOffset
)

Parameters

dateTimeOffset
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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft