Date Format

Personally, I’ve used many different date formats and notations. Sometimes I’d write mm/yy, sometimes it’d be mm/dd/yy or mm/dd/yyyy. Well, for better or worse, I’ve settled on my personal preference:

YYYYMMDD or yyyy.mm.dd or YYYY/MM/DD

I don’t know what’s the best for you, but this one has been good for me. One of the main reasons I settled on it was because it’s sortable. I use it as a prefix for my documents, and i can always sort. In contrast, sometime I version my files like filename_1, filename_2, which is cool until you get to filename_10, in which case sorting no longer does what it should. Equally bad, you can totally lose track on the sequence when one file changes names. Do you start over at _1 when the detail page is now referred to as the item page? With timestamps in the yyyymmdd format, you can always tell the order of things.

In our world of massive iteration, order is crucial. It’s often the only constant we have!

I wasn’t very confident in this approach, but I knew it worked for me. Doing a little searching finally, i found that it’s actually a ISO Spec #8601. So that settles it, I’ve found my date format of choice.

Which format do you use? Why? What cases haven’t I considered?


Turns out people have talked about this, and this page has a nice Eleven good reasons to use it section which I’ve reproduced here:

  • language independent – a true international standard from the International Organisation for
    Standardisation
    (see Note 1 below)
  • cannot be confused with any other popular date notations
  • consistency with the common time notation system, where the larger unit (hour) is
    written in front of the smaller ones (minutes and seconds)
  • easily readable and writeable by software (no month name to number conversion
    necessary)
  • easily comparable and sortable with a trivial string comparison
  • strings containing a date followed by a time are also easily comparable and sortable
    e.g. 1996-01-15 22:45:37 with most significant value to the left
  • the notation is short and has constant length, which makes both keyboard data
    entry and table layout easier
  • identical to the Chinese date notation, so the largest cultural group (>25%)
    on this planet is already familiar with it – so no feeble excuses like “but no-one
    uses this format…”
  • date notations with the order “year, month, day” are in already widely used

    in Japan, Korea, Hungary, Sweden, Finland, Denmark to name just a few. Even people in the US
    are already used to at least the “month, day” ordering

  • a 4-digit year representation would have avoided the Year 2000 problem.  If only
    they had thought of that when computer technology was being developed…
  • Astronomers have been using this format for centuries