DateTimeOffset.ToUniversalTime Method ()


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

Converts the current DateTimeOffset object to a DateTimeOffset value that represents the Coordinated Universal Time (UTC).

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

member ToUniversalTime : unit -> DateTimeOffset

Return Value

Type: System.DateTimeOffset

An object that represents the date and time of the current DateTimeOffset object converted to Coordinated Universal Time (UTC).

This method returns a DateTimeOffset object whose Offset property is set to zero.

Both the value of the current DateTimeOffset object and the value of the DateTimeOffset object returned by the method call represent the same point in time. That is, if both are passed to the DateTimeOffset.Equals(DateTimeOffset, DateTimeOffset) method, the method will return true.

The following example calls the ToUniversalTime method to convert a local time and several other times to Coordinated Universal Time (UTC).

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

Universal Windows Platform
Available since 8
.NET Framework
Available since 2.0
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