In C#, a Windows file time is the number of 100-nanosecond steps since January 1, 1601 (UTC). DateTime.FromFileTime reads that number and returns a DateTime in the computer's local time zone.
Use FromFileTimeUtc when you want a UTC result instead. File times appear in Windows APIs, file properties, and some network formats.
This is a static member of System.DateTime. You call it with the type name, such as DateTime.FromFileTime(...). DateTime holds a date and time of day with a Kind of Utc, Local, or Unspecified.
Syntax
Call it with the type name and a long file time.
C#
long ft = 134394858450000000; // 2026-11-18 14:30:45 UTC
DateTime local = DateTime.FromFileTime(ft); // Kind: Local
DateTime utc = DateTime.FromFileTimeUtc(ft); // Kind: Utc
Call
What it does
DateTime.FromFileTime(ft)
File time to local time.
DateTime.FromFileTimeUtc(ft)
The same number to UTC.
dt.ToFileTime()
The opposite direction.
Because the result depends on the zone of the computer, the examples below print the Kind and compare with the UTC version instead of printing the local clock time.
Library declarations
C#
public static DateTime FromFileTime(long fileTime);
Parameters
Parameter
Description
fileTime
Required. A Windows file time: ticks since January 1, 1601 UTC. Must not be negative.
Return Value
Return Value
Description
DateTime
The date and time in the local zone, with Kind.Local.
C# Examples
Example 1 — Two Kinds from One Number
Convert one file time two ways and print the Kind and the UTC clock.
C#
using System;
using System.Globalization;
class Program {
static void Main() {
long ft = 134394858450000000;
DateTime local = DateTime.FromFileTime(ft);
DateTime utc = DateTime.FromFileTimeUtc(ft);
Console.WriteLine(local.Kind);
Console.WriteLine(utc.Kind);
Console.WriteLine(utc.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture));
}
}
Output
Local
Utc
2026-11-18 14:30:45
How It Works
One number.134394858450000000 is a file time for November 18, 2026, 14:30:45 UTC.
FromFileTime. It returns local time, so its Kind is Local.
FromFileTimeUtc. It returns UTC, so its Kind is Utc.
Stable text. Only the UTC value is printed as a clock, because it is the same on every computer.
Example 2 — Back and Forth
Convert the local result back to UTC and back to a file time.
C#
using System;
class Program {
static void Main() {
long ft = 134394858450000000;
DateTime local = DateTime.FromFileTime(ft);
Console.WriteLine(local.ToUniversalTime() == DateTime.FromFileTimeUtc(ft));
Console.WriteLine(local.ToFileTime() == ft);
}
}
Output
True
True
How It Works
Local value.local holds the same moment as the UTC value, shown on the local clock.
ToUniversalTime. Shifting it back gives the UTC version, so the first line is True.
ToFileTime. Converting the local value back returns the original number.
Second line True. The round trip loses nothing for this normal date.
Example 3 — The Local Shift
Prove that local time differs from UTC by exactly the zone offset.
C#
using System;
class Program {
static void Main() {
long ft = 134394858450000000;
DateTime local = DateTime.FromFileTime(ft);
DateTime utc = DateTime.FromFileTimeUtc(ft);
TimeSpan shift = local - utc;
Console.WriteLine(shift == TimeZoneInfo.Local.GetUtcOffset(utc));
}
}
Output
True
How It Works
Two clocks. One is local and one is UTC, built from the same file time.
Subtract them. The TimeSpan is how many hours the local clock is ahead of UTC.
Ask the zone.GetUtcOffset returns the zone's offset for that moment.
Always True. The check holds in every time zone, so the output never changes.
Frequently Asked Questions
It is the number of 100-nanosecond steps since January 1, 1601 (UTC).
FromFileTime returns local time (Kind Local). FromFileTimeUtc returns UTC (Kind Utc).
It throws ArgumentOutOfRangeException.
Use dt.ToFileTime() for local or dt.ToFileTimeUtc() for UTC.
The local clock changes with the computer time zone, so the tutorial prints Kind and checks instead.