How to write dates correctly 1

Times and dates have the reputation to be a nightmare for programmers since the beginning of the internet. Unfortunately, this is also a problem for the users which face a plethora of time format. Depending on the websites, the following date 01/02/03 may refer to

  • 1st of February 2003;

  • 2nd of January 2003;

  • 3rd of February 2001.

This is highly inconvenient and give headaches to both users and programmers. Now, think of how awesome would it be if everybody used the same format, if some kind of organization issued some standards that everybody would follow. Wait… This exists already, and its name is the ISO, the International Organization for Standardization. They created in 1988 the ISO 8601 on the representation of dates and times.

ISO 8601

A date is written


with a four-digit year [YYYY], a two-digit month code [MM] and a two-digit day code [DD], separated by a hyphen [-].

Everything you need to know about the ISO 8601 can be found on its wikipedia page. Do not hesitate to spread the word around you.

I will myself do my part by inaugurating my own ISO 8601 wall of shame.

Let’s conclude with a relevant xkcd.

relevant xkcd

Relevant xkcd [source].



This article was written on 2020-03-02.