Why You Should Use the ANSI/ISO Date Format


With the new millennium now upon us and the need to represent dates unambiguously being rather pressing, I thought I’d make the switch to denoting dates with the ANSI/ISO standard format, “YYYY-MM-DD” (ISO 8601).

My aversion to the conventional “6/3/89” type of thing is threefold:

  1. It is unclear which year is being referred to. Does it mean 1989, 1889, 2089, …?
  2. It is ambiguous which day and month are represented. In some parts of the world, it means “the 6th of March”, elsewhere “the 3rd of June”.
  3. When sorted alphabetically, these dates do not fall into chronological order.

Dates represented under the ANSI/ISO standard date format (e.g. “1989-03-06“) do not suffer from these problems:

  1. Years are represented unambiguously, using 4 digits (though I’m not certain if the standard allows more for years after 9999—has “Y10K” been coined yet?),
  2. Day and month numbers will no longer be confused, because no other (common?) date format begins with the year field,
  3. ANSI dates sort into chronological order even when treated alphabetically, because they are big-endian and each field is zero-padded and fixed-width.

If you'd like to know more, have a look at this more detailed description of date standardisation by Markus Kuhn.


Questions, comments, compliments, or complaints? Send Internet e-mail to “cme at ihug dot co dot nz”.

This page has been accessed 63 times, apparently.
This document last modified and © 2001-09-17 11:49:21 NZST