Share via


ToUniversalTime Method

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

Converts the value of the current DateTime object to Coordinated Universal Time (UTC).

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

Syntax

'Declaration
Public Function ToUniversalTime As DateTime
public DateTime ToUniversalTime()
public:
DateTime ToUniversalTime()
member ToUniversalTime : unit -> DateTime 
public function ToUniversalTime() : DateTime

Return Value

Type: System. . :: . .DateTime
An object whose Kind property is Utc, and whose value is the UTC equivalent to the value of the current DateTime object, or MaxValue if the converted value is too large to be represented by a DateTime object, or MinValue if the converted value is too small to be represented by a DateTime object.

Remarks

The value of the new DateTime object is a MaxValue field if the converted value is too large to be represented by a DateTime object, or it is a MinValue field if the converted value is too small to be represented by a DateTime object.

The UTC time is equal to the local time minus the UTC offset. For more information about the UTC offset, see the GetUtcOffset method. Note that the conversion also takes into account the daylight saving time rule that applies to the value of the current DateTime object.

.NET Framework Security

See Also

Reference

DateTime Structure

System Namespace