What is the range of dates that windows explorer can display?
I want to set the created date on some old scanned pictures to a date in 1970. If I do that using a third party tool, Windows explorer displays the date as blank. I thought NTFS could go back to the 1600s some time. What is going on?
Quick analysis
When browsing folders, Windows Explorer won't display dates outside a specific range:
The MS-DOS date format can represent only dates between 1/1/1980 and 12/31/2107.
Source: FileTimeToDosDateTime function
This can be confirmed by manually setting the date:
My assumption is that this behavior is related to backward compatibility. When NTFS didn't exist, the created, modified, and access dates were designed to take 16 bits each (2 bytes). The information gets packed like this:
Bits | Description
-------------------------------------------------------
0–4 | Day (1-31)
5–8 | Month (1 = January, 2 = February, etc.)
9-15 | Year offset from 1980 (0 = 1980, 1 = 1981, etc.)
To save bits, the year isn't stored as a whole number; an offset is used instead. Since there are 7 bits, that means 2^7 = 128
possible values, i.e. 1980-2107.
As for NTFS, this is what the documentation says:
A file time is a 64-bit value that represents the number of 100-nanosecond intervals that have elapsed since 12:00 A.M. January 1, 1601 Coordinated Universal Time (UTC). The system records file times when applications create, access, and write to files.
The NTFS file system stores time values in UTC format, so they are not affected by changes in time zone or daylight saving time. The FAT file system stores time values based on the local time of the computer.
Source: File Times
Further reading
- File Times
- File Systems
- Interpretation of NTFS Timestamps
Workaround
In certain cases you might be able to bypass this issue through EXIF tags:
The file properties dialog can display any date supported by the underlying file system:
Same goes with the command-line interface when using the dir
command:
01/01/1601 02:23 AM 0 1-oldest.txt
01/01/1970 02:23 AM 0 2-older.txt
01/01/1980 02:23 AM 0 3-old.txt
01/01/2014 02:23 AM 0 4-current.txt
01/01/2107 02:23 AM 0 5-new.txt
01/01/9999 02:23 AM 0 6-newer.txt
Third-party programs such as 7-Zip might also be unaffected: