Categories


Authors

A universal date format

The United Kingdom generally uses the date format DD/MM/YYYY and the United States of America generally uses the date format MM/DD/YYYY. So, depending on where you're from, 05/03/2015 could be interpreted as the 5th of March 2015 or the 3rd of May 2015, respectively. The only way to determine at-a-glance which of the two that the author intended would be via context but that's not always provided. Thus far, I have intentionally provided no context thereby illustrating just how frustrating it can be - either is equally likely. (For your own curiosity, I'm from the United Kingdom.)

This has always lightly bothered me but never to the point to do anything about it until, somewhat bizarrely, I started using FireShot and Greenshot (two excellent screenshotting tools). See, both tools offer the option of setting your own custom filename template / pattern and many variables to use, including time segments (years, months, days, hours, minutes, and seconds). Considering I was using these tools to document procedures, the obvious thing to do was to prepend the filename with the time that the screenshot was captured so that the screenshots are arranged chronologically. So, I chose a filename template / pattern of DD-MM-YYYY HH-MM-SS - Title which worked great... for a while.

A few weeks later I noticed a problem: Windows has no concept of chronology or basic intelligence when it comes to sorting files by name and instead just blindly and dumbly sorts everything alphanumerically from left to right. As an extreme example, I end up with the following, which is obviously not chronological:

So, I modified the filename template / pattern to YYYY-MM-DD HH-MM-SS - Title in an effort to work around Windows' limitations. This really did work great and has continued to do so ever since. Now I end up with the following:

This got me thinking: Why isn't YYYY-MM-DD the universal date format? After all:

  • The intended date can be determined regardless of author context or location.

  • It follows the format of largest-to-smallest time unit that is already used for the generally universal time format of HH:MM:SS.

  • Filenames are ordered chronologically in Windows.

  • etc

After a light bit of research, I discovered that it is the universal date format as defined by the International Organization for Standardization (ISO) in 1988 as ISO 8601.

So, if that list of pros over the alternatives and an ISO standard can't get the world to see sense then my lowly blog post doesn't have a chance in hell. Oh, well. I just wanted to finally get started blogging! :)

Update 2015/03/05 12:51 (see what I did there?): It seems that blogging platforms agree with me: https://mythofechelon.wordpress.com/2015/03/05/a-universal-date-format/ ;)

Update 2020/04/20 15:46: Considering how much attention this post gets (which I still can’t believe), I thought I’d share my regular expression / regex that I use with apps like ReNamer and RegExr to automatically reorder from DD/MM/YYYY to YYYY/MM/DD:

  • Find expression: (.*)(\d{2})-(\d{2})-(\d{4})

  • Replace with: $1$4-$3-$2

The rise of Two Factor Authentication