Share via


ToUniversalTime Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Returns the Coordinated Universal Time (UTC) that corresponds to a specified time.

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

Syntax

'Declaration
Public Overridable Function ToUniversalTime ( _
    time As DateTime _
) As DateTime
public virtual DateTime ToUniversalTime(
    DateTime time
)
public:
virtual DateTime ToUniversalTime(
    DateTime time
)
abstract ToUniversalTime : 
        time:DateTime -> DateTime 
override ToUniversalTime : 
        time:DateTime -> DateTime 
public function ToUniversalTime(
    time : DateTime
) : DateTime

Parameters

Return Value

Type: System. . :: . .DateTime
A DateTime object whose value is the Coordinated Universal Time (UTC) that corresponds to time.

Remarks

If the local time zone observes daylight saving time, ToUniversalTime applies the current adjustment rule to the time parameter when performing the conversion.

If the time parameter is an ambiguous time, the method assumes that it is a standard time. (An ambiguous time is one that can map either to a standard time or to a daylight saving time in the local time zone.) If time is an invalid time, the method simply subtracts the local time from the local time zone's UTC offset to return UTC. (An invalid time is one that does not exist because of the application of daylight saving time adjustment rules.)

.NET Framework Security

See Also

Reference

TimeZone Class

System Namespace