Since 2010

ISO 8601

I’m a huge fan of the ISO 8601 standard, which describes an international standard for the display and exchange of dates and times. This xkcd comic highlights one of the common problems.

But there’s a super-handy bonus reason to use YYYY-MM-DD: because the format goes from most to least significant component, the dates are easy to sort. This rule continues to hold true if you keep going with the ISO and add times. As long as the dashes, colons and spaces are all consistent, the date effectively becomes a big integer which increases with the date and time.

For example, a file titled 2013-02-28 19:56 important file would, if sorted in ascending order, correctly appear before a file created at a later time (2013-02-28 20:03 foo file) or a later date (2013-10-01 11:34 bar file).

So that’s settled - we must all stop using DD/MM/YYYY, and the even more illogical format of MM/DD/YYYY.