June 03, 2003
ISO 8601: The standard date format

I would like to chip in an argument in favour of ISO 8601 - the International Standard Date and Time Notation.

Some people might have noticed that I'm trying to consistently promote YYYY-MM-DD as a date format; and the reasons for this are plenty:

  • It survives cross-cultural translation (few things annoy me more than (typically travel) websites expecting a date-input without specifying the format: some websites seem to think that everyone in the world naturally enter MM/DD/YY, some are DD/MM/YYYY etc)
  • It sorts better! Which list (e.g. if dates are used in file names) is more intuitive?
    1. MM/DD/YY:
      • 01/15/00
      • 05/29/03
      • 05/31/03
      • 06/02/03
      • 12/02/99
    2. DD/MM/YY:
      • 02/06/03
      • 02/12/99
      • 15/01/00
      • 29/05/03
      • 31/05/03
    3. or chronologically sorted YYYY-MM-DD?
      • 1999-12-02
      • 2000-01-15
      • 2003-05-29
      • 2003-05-31
      • 2003-06-02
  • It's an international standard that we will see more of in the future - why not adapt today?
Briefly summarized, the ISO 8601 standard promotes the yyyy-mm-dd date format, and/or yyyy-mm-ddTHH:MM:SS if date and time are stored together in a single data field. When present, month and day are written using two-digit numbers, with leading zeros as appropriate. Month is 01 through 12 and day is 01 through 31.

[Exceptions apply if used for years earlier than 1752 (the year of the British Calendar Correction where they caught up 11 days with the date corrections France and Spain did in 1582... Messy, so don't go there ;-) ]

There are several great resources about the standard online, so I will point you in their direction instead of repeating it all here:

Sponsored links
Related Entries

SQL got me used to ISO-8601. Well, for the most part. Also, AIX timestamps are YYYYMMDDHHMMSS, so I got pretty used to thinking biggest->smallest. Also, keeping the weblog that way is nice.

Posted by: Eli Sarver on June 3, 2003 10:49 PM

I agree wholeheartedly. I stumbled on the format a couple years ago, without knowing its particular ISO specification, and immediately adopted it. Now my files sort correctly, and I can trust others to be able to correctly decode my dates.

Posted by: Brad Gadberry on June 4, 2003 06:00 PM

Indeed, this is the only format that makes sense.

And the following is *almost* relevant but interesting nonetheless:

Posted by: Agnar Ødegård on June 5, 2003 06:31 PM
Post a comment

(Will not be displayed if you enter a website below. Otherwise, it will be displayed "spam protected")

(if you have one)

What do you want to say?
(please don't bother posting "spam" (pornography, viagra-sales etc - I will delete such comments anyway))

Remember info?

Referrers to this page
TrackBack URL for this entry:
Cantoni.org: ISO8601 (June 3, 2003 07:31 PM)
"Anders Jacobsen's blog: ISO 8601: The standard date format is a good read for anyone wanted a good background on why this format is helpful not only for international users, but also for sorting (my particular reason for liking it..."

[an error occurred while processing this directive]

© Anders Jacobsen
[extrospection.com photography]