C# DateTime FromFileTimeUtc() Method

Beginner
5 min read
Updated: Nov 2026
3 examples
DateTime

Definition

In C#, DateTime.FromFileTimeUtc reads a Windows file time (100-nanosecond steps since January 1, 1601 UTC) and returns a DateTime with Kind.Utc.

The result is the same on every computer, which makes it the safer choice than FromFileTime for stored data.

This is a static member of System.DateTime. You call it with the type name, such as DateTime.FromFileTimeUtc(...). 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#
DateTime start = DateTime.FromFileTimeUtc(0);                  // 1601-01-01
DateTime day = DateTime.FromFileTimeUtc(134394336000000000);     // 2026-11-18
DateTime unix = DateTime.FromFileTimeUtc(116444736000000000);    // 1970-01-01
CallWhat it does
DateTime.FromFileTimeUtc(0)The start of file time: January 1, 1601.
DateTime.FromFileTimeUtc(ft + TimeSpan.TicksPerDay)Add one day in file-time units.
dt.ToFileTimeUtc()The opposite direction.

Add TimeSpan.TicksPerDay, TicksPerHour, and the other constants to a file time to move it, because one file-time step equals one tick.

Library declarations
C#
public static DateTime FromFileTimeUtc(long fileTime);

Parameters

ParameterDescription
fileTimeRequired. A Windows file time (ticks since January 1, 1601 UTC). Must not be negative.

Return Value

Return ValueDescription
DateTimeThe date and time in UTC, with Kind.Utc.

C# Examples

Example 1 — The Start of File Time

Convert 0 and read the Kind.

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        DateTime start = DateTime.FromFileTimeUtc(0);
        Console.WriteLine(start.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture));
        Console.WriteLine(start.Kind);
    }
}

How It Works

  1. Zero steps. A file time of 0 means no time has passed since the starting point.
  2. Start in 1601. The starting point is midnight on January 1, 1601 UTC.
  3. Utc Kind. The method marks the result as UTC.
  4. Older than Unix. The Unix epoch starts in 1970, 369 years later.

Example 2 — Move a File Time

Convert a known file time and then add one day of ticks.

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        long ft = 134394336000000000;
        CultureInfo inv = CultureInfo.InvariantCulture;
        Console.WriteLine(DateTime.FromFileTimeUtc(ft).ToString("yyyy-MM-dd HH:mm:ss", inv));
        Console.WriteLine(DateTime.FromFileTimeUtc(ft + TimeSpan.TicksPerDay).ToString("yyyy-MM-dd HH:mm:ss", inv));
    }
}

How It Works

  1. Known number. 134394336000000000 is midnight UTC on November 18, 2026.
  2. Convert. The first line prints that midnight.
  3. One day of ticks. TimeSpan.TicksPerDay is 864,000,000,000, and file-time steps are ticks.
  4. Next day. Adding that amount gives midnight on November 19.

Example 3 — Unix Epoch and a Bad Number

Convert the Unix epoch value and catch an invalid file time.

C#
using System;
using System.Globalization;

class Program {
    static void Main() {
        DateTime unix = DateTime.FromFileTimeUtc(116444736000000000);
        Console.WriteLine(unix.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture));
        try {
            DateTime.FromFileTimeUtc(-1);
        } catch (ArgumentOutOfRangeException) {
            Console.WriteLine("Invalid file time");
        }
    }
}

How It Works

  1. Epoch constant. 116444736000000000 is the file time of January 1, 1970.
  2. Unix date. The first line shows that 1970 date at midnight UTC.
  3. Negative number. File times before 1601 do not exist, so -1 is rejected.
  4. Caught. ArgumentOutOfRangeException is handled and a message is printed.

Frequently Asked Questions

A DateTime in UTC for a Windows file time, with Kind set to Utc.
January 1, 1601 at 00:00:00 UTC.
116444736000000000.
It throws ArgumentOutOfRangeException.
FromFileTimeUtc, because its result does not depend on the computer time zone.

Next: FromOADate()

Convert an OLE Automation date (a double, used by Excel and COM) to a DateTime with System.DateTime.

FromOADate() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

13 people found this page helpful