Compartir a través de


DateTime.ToUniversalTime Method

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

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

Syntax

public DateTime ToUniversalTime ()

Return Value

A new DateTime object that contains the UTC equivalent of the value of the current 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.

Version Information

Available in the .NET Micro Framework versions 2.0, 2.5, 3.0, 4.0, and 4.1.

See Also

Reference

DateTime Structure
DateTime Members
System Namespace