Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Why Windows File Timestamps Count From 1601

· 5 min read · Home Tech

In this article
  1. The FILETIME Structure
  2. Why 1601 Specifically
  3. How the Math Works
  4. Comparison with Unix Time
  5. Common Misconceptions
  6. Practical Implications
  7. Frequently Asked Questions

Windows file timestamps count from January 1, 1601 because the Gregorian calendar repeats every 400 years, and 1601 is the start of the most recent 400-year cycle when the system was designed. The FILETIME structure stores elapsed 100-nanosecond intervals since that moment, chosen to simplify date calculations for the original NT developers.

The FILETIME Structure

Windows stores file times as a 64-bit unsigned integer representing the number of 100-nanosecond intervals since midnight, January 1, 1601 UTC. The value can range from 0 (the epoch) up to 18,446,744,073,709,551,615, which corresponds to roughly year 30828. This format is used not just for files but for many system timestamps, including registry keys, event logs, and directory entries.

When you right-click a file and view properties, Windows converts this raw integer into a human-readable date and time. The conversion is straightforward: divide the FILETIME by 10,000,000 to get seconds, then add the result to the 1601 epoch using standard date arithmetic.

Why 1601 Specifically

The choice of 1601 is often attributed to the Gregorian calendar's 400-year cycle. The Gregorian calendar repeats its pattern of leap years every 400 years, and 1601 is the first year of a cycle that began on a Monday. By selecting a cycle start, developers could simplify calculations involving weekdays and leap-year rules.

Dave Plummer, a former Microsoft developer, explained in a 2021 YouTube video that the NT team needed a date that would allow easy computation of the day of the week. They chose the start of the current 400-year Gregorian cycle, which is January 1, 1601. This made it possible to use a simple algorithm to determine the weekday for any date within the cycle, without complex modular arithmetic.

How the Math Works

The core formula for converting a FILETIME to a date is:

seconds = FILETIME / 10,000,000
days = seconds / 86,400

Then, starting from the epoch (1601-01-01), add the number of days to get the calendar date. The 400-year cycle contains 146,097 days (400 × 365 + 97 leap days). To find the day of the week, you can compute (days + 1) mod 7, because 1601-01-01 was a Monday (day 0 = Monday).

For example, the FILETIME value for 2024-01-01 00:00:00 UTC is 133,460,064,000,000,000. Dividing by 10,000,000 gives 13,346,006,400 seconds, which equals 154,468 days. Adding 154,468 days to 1601-01-01 yields 2024-01-01, and (154468 + 1) mod 7 = 1, which is Tuesday (since 0=Monday, 1=Tuesday).

Comparison with Unix Time

Unix and Linux systems use a different epoch: January 1, 1970. Unix time counts seconds since that moment, not 100-nanosecond intervals. The choice of 1970 is arbitrary but convenient because it was near the time Unix was developed. Windows chose 1601 for the reasons above, but the practical effect is that the two systems represent times differently, requiring conversion when sharing files across platforms.

To convert a Unix timestamp to a Windows FILETIME, you add the number of 100-nanosecond intervals between 1601 and 1970, which is 116,444,736,000,000,000. This constant appears in many cross-platform libraries.

Common Misconceptions

One misconception is that Windows timestamps are stored in local time. In fact, FILETIME is always UTC. The file system stores UTC times, and the shell displays them converted to the user's time zone. This is why a file created at 3:00 PM in New York appears as 8:00 PM in London if you move it to a server and view it from there.

Another misconception is that the 1601 epoch was chosen because of the Gregorian calendar's introduction in 1582. While related, the actual reason is the 400-year cycle, not the calendar's adoption date. The Gregorian calendar was introduced in 1582, but 1601 is the start of the first full 400-year cycle after that.

Also, some believe that the 100-nanosecond resolution is overkill. However, it allows precise timing for file operations, which is useful for build systems, database transactions, and forensic analysis.

Practical Implications

For developers, understanding FILETIME is crucial when working with Windows APIs. Functions like GetFileTime and SetFileTime use FILETIME structures. When writing code that reads or writes file timestamps, you must convert between FILETIME and your language's native date type.

For users, the epoch rarely matters. But if you ever see a file with a date of 1601, it usually indicates a zero FILETIME, which can happen when a file is created but not yet written to, or when a timestamp is not set. In NTFS, a zero FILETIME is displayed as 1601-01-01, which is a sign that the value is uninitialized.

When copying files between Windows and Unix systems, tools like rsync or Samba handle the conversion automatically. However, if you manually parse raw binary data, you must apply the correct offset to avoid off-by-369-year errors.

Frequently Asked Questions

Why not 1970 like Unix?

Windows NT was designed independently of Unix, and the developers chose 1601 to align with the Gregorian calendar's 400-year cycle. This made weekday calculations easier. Unix's 1970 epoch was chosen for simplicity and because it was near the time Unix was created, but it has no calendar significance.

What is the maximum date representable by FILETIME?

The maximum value of a 64-bit FILETIME is 18,446,744,073,709,551,615, which corresponds to about 30,828 AD. This is far beyond any practical use, but it means the format will not overflow for thousands of years.

How do I convert a FILETIME to a human-readable date?

In many programming languages, you can use built-in functions. For example, in C# you can use DateTime.FromFileTimeUtc(). In Python, you can use the datetime module with the appropriate offset. The formula is: divide by 10,000,000 to get seconds, then add to 1601-01-01.

Why does a file show 1601-01-01?

That usually means the FILETIME value is zero. This can happen if a file is created but never written to, or if the timestamp is not set by the file system. It is not a real date; it is a placeholder indicating no timestamp.

Does Windows use FILETIME for all timestamps?

Mostly yes. NTFS stores file creation, modification, and access times as FILETIME. The registry and many system logs also use FILETIME. However, some formats like FAT use different structures, and Windows converts them to FILETIME when reading.