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)

public DateTime ToUniversalTime()

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.

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.

Show: