Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
[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
- time
Type: System. . :: . .DateTime
A Coordinated Universal Time (UTC) time.
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see dd66cd4c-b087-415f-9c3e-94e3a1835f74.