Why do my file creation, access, or modified time disappear if I set it to midnight on January 1, 1980?

Raymond Chen

Raymond

A customer discovered that if their program used the Set­File­Time function to set a network file’s creation, access, or modified time to the specific value of “midnight on January 1, 1980”, then the corresponding timestamp is removed. What’s up with that?

As you may recall, midnight on January 1, 1980 is a special sentinel value: It is the epoch for the MS-DOS time/date format.

At this point, I believe the responsible thing to do is to speculate irresponsibly.

It appears that the network server they are using is trying very hard to accommodate MS-DOS clients. In particular, if somebody tries to set a file timestamp to midnight January 1, 1980, the server assumes that the client is trying to clear the timestamp.

Explorer is one of those accommodating programs. If it sees a file whose timestamp is exactly January 1, 1980 at midnight, then it assumes that the timestamp came from a FAT filesystem (possibly tunnelled through other file systems along the way, like a network redirector), and treats it as equivalent to a missing timestamp.

Raymond Chen
Raymond Chen

Follow Raymond