ToLocalTime 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 local time.

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

'Declaration
Public Function ToLocalTime As DateTime

Return Value

Type: System..::..DateTime
An object whose Kind property is Local, and whose value is the local time 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 as 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 TimeZone..::..GetUtcOffset. The conversion also takes into account the daylight saving time rule that applies to the time represented by the current DateTime object.

The value returned by the conversion is a DateTime whose Kind property always returns Local. Consequently, a valid result is returned even if ToLocalTime is applied repeatedly to the same DateTime.

Show: