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?
- or chronologically sorted YYYY-MM-DD?
- 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:
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.
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.
Referrers to this page
TrackBack URL for this entry:
: 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..."
37308 visits (3 today, 10 this week)