Share via


ToLocalTime Method

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

Returns the local time that corresponds to a specified date and time value.

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

Syntax

'Declaration
Public Overridable Function ToLocalTime ( _
    time As DateTime _
) As DateTime
public virtual DateTime ToLocalTime(
    DateTime time
)
public:
virtual DateTime ToLocalTime(
    DateTime time
)
abstract ToLocalTime : 
        time:DateTime -> DateTime 
override ToLocalTime : 
        time:DateTime -> DateTime 
public function ToLocalTime(
    time : DateTime
) : DateTime

Parameters

Return Value

Type: System. . :: . .DateTime
A DateTime object whose value is the local time that corresponds to time.

Remarks

The following table shows the relationship between the time parameter and the DateTime value returned by this method.

time parameter

Behavior

Return value

A Coordinated Universal Time (UTC) time (DateTimeKind..::..Utc).

Converts the time from UTC to the local time.

A DateTime object whose value is the local time that corresponds to time.

A local time (DateTimeKind..::..Local).

No conversion necessary.

The same DateTime value represented by the time parameter.

An unspecified time (DateTimeKind.Unspecified).

Assumes that the time is UTC and converts it from UTC to the local time.

A DateTime object whose value is the local time that corresponds to time.

If the local time zone observes daylight saving time, ToLocalTime applies the current adjustment rule to time when performing the conversion.

.NET Framework Security

See Also

Reference

TimeZone Class

System Namespace