Share via


DateTime.ToLocalTime Method

Converts the current value of the current DateTime object to local time.

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

Syntax

public DateTime ToLocalTime ()

Return Value

A new DateTime object with the local-time equivalent of the current value of the current DateTime object.

Remarks

The value of the new DateTime object is 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 local time is equal to the Coordinated Universal Time (UTC) time plus the UTC offset. For more information about the UTC offset, see the GetUtcOffset method. The conversion also takes into account the daylight saving time rule that applies to the current 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