In C#, DateTime.ToLocalTime() converts a UTC value to the local time of the computer that runs the code. The result has Kind.Local.
The answer depends on the machine's time zone, so the examples below test the rules (kind and offset) instead of printing a clock value that would change.
This is an instance member of System.DateTime. You call it on a DateTime value, such as dt.ToLocalTime(...). DateTime is a struct, so every value is copied and never changed in place.
Syntax
Call it on a DateTime. It takes no arguments.
C#
DateTime utc = new DateTime(2026, 11, 18, 10, 0, 0, DateTimeKind.Utc);
DateTime local = utc.ToLocalTime(); // Kind is Local
Call
What it does
utc.ToLocalTime()
UTC to local time. Kind becomes Local.
local.ToLocalTime()
A Local value is returned unchanged.
unspecified.ToLocalTime()
An Unspecified value is treated as UTC and converted.
For other zones, use TimeZoneInfo.ConvertTimeFromUtc(utc, zone). ToLocalTime only knows the zone of the computer.
Library declarations
C#
public DateTime ToLocalTime();
Parameters
Parameter
Description
None
ToLocalTime() takes no parameters.
Return Value
Return Value
Description
DateTime
A new DateTime in local time with Kind.Local.
C# Examples
Example 1 — Utc to Local
Convert a UTC value and read the Kind of both values.
C#
using System;
class Program {
static void Main() {
DateTime utc = new DateTime(2026, 11, 18, 10, 0, 0, DateTimeKind.Utc);
DateTime local = utc.ToLocalTime();
Console.WriteLine(utc.Kind);
Console.WriteLine(local.Kind);
}
}
Output
Utc
Local
How It Works
Start in UTC. The value is built with DateTimeKind.Utc.
New value.ToLocalTime returns a copy; utc itself stays Utc.
Kind is Local. The result is marked as local time.
No clock printed. The actual hour would depend on your time zone, so the code prints the Kind instead.
Example 2 — Check the Offset
Prove that the shift equals the zone's UTC offset.
C#
using System;
class Program {
static void Main() {
DateTime utc = new DateTime(2026, 11, 18, 10, 0, 0, DateTimeKind.Utc);
DateTime local = utc.ToLocalTime();
TimeSpan shift = local - utc;
Console.WriteLine(shift == TimeZoneInfo.Local.GetUtcOffset(utc));
}
}
Output
True
How It Works
Subtract the two values.local - utc gives the shift the conversion applied.
Zone offset.GetUtcOffset(utc) asks the local zone how far it is from UTC at that moment.
They match. The comparison is True on every computer.
Works in any zone. In a UTC+5:30 zone the shift is 5.5 hours, in UTC-5 it is minus five hours.
Example 3 — Local and Unspecified Inputs
Show how Unspecified and Local inputs behave.
C#
using System;
class Program {
static void Main() {
DateTime unspecified = new DateTime(2026, 11, 18, 10, 0, 0);
DateTime asUtc = DateTime.SpecifyKind(unspecified, DateTimeKind.Utc);
Console.WriteLine(unspecified.ToLocalTime() == asUtc.ToLocalTime());
DateTime local = new DateTime(2026, 11, 18, 10, 0, 0, DateTimeKind.Local);
Console.WriteLine(local.ToLocalTime() == local);
}
}
Output
True
True
How It Works
No Kind set.unspecified has Kind.Unspecified.
Treated as UTC. Converting it gives the same result as converting the same time marked Utc.
Already local. A Local value passes through ToLocalTime unchanged.
Both lines True. These rules are why you should set Kind before converting.
Frequently Asked Questions
It converts a UTC DateTime to the local time zone of the computer and sets Kind to Local.
ToLocalTime treats it as UTC and converts it. ToUniversalTime treats Unspecified as local.
It is returned unchanged.
The result depends on the computer time zone, so the tutorial checks Kind and offset rules that never change.