Conifer Productions

From ideas to apps. From mobile to global.

12 12 12

Here we go again… Today is December 12, 2012 in the Gregorian calendar, and people are waxing poetic about how symmetrical, how repetitive and how unique this date is. (Even people who really should know better.) Some people are even getting married today. I wish them the best of luck.

But let me put my science hat on for a moment, and offer the following statement:

The symmetry / reflexivity / repetitiveness / uniqueness of a date expression such as 12/12/12, 11/11/11 etc. ad nauseam, is not axiomatic. It is an artefact of the presentation layer.

In layman’s terms:

It’s not really like that, it’s just written that way.

Just for fun, I wrote a small Java program to print out

“medium-style” “short style” dates for today, using all the available locales in OS X Mountain Lion (running Java SE 1.6.0_37). Here is a sample of the list (it contains 152 entries in total):

English (United Kingdom) : 12/12/12
Hungarian : 2012.12.12.
Portuguese (Portugal) : 12-12-2012
Greek (Cyprus) : 12/12/2012
Swedish : 2012-12-12
Finnish (Finland) : 12.12.2012
Korean : 12. 12. 12
Thai (Thailand) : 12/12/2555
Chinese (Hong Kong) : 12年12月12日
Danish (Denmark) : 12-12-12

Doesn’t look too symmetrical, does it? That’s because today’s date is December 12, and the year is 2012, not 12. (Except when it isn’t, like in Thailand.)

Seems like we learned nothing from the Year 2000 scare, when much attention was paid to the fact that software systems had been storing years with only two digits, with potential problems when the year “rolls over” from 99 to 00 when the year 2000 came around. (Were there none, or were they just fixed in time? Yes and no to both.)

Now it is 12 years into the new millennium, and we’re establishing the same practice with attaching special significance to dates like 12/12/12, 11/11/11, 10/10/10, 09/09/09. And it’s all too well that this pattern cannot continue, because there are only 12 months (which is true for the Gregorian calendar, but not for the Hebrew calendar).

And from here on, people will go on writing years with just two digits because the conventions are so strong. And the international date and time standard, ISO 8601, will continue to specify four digits for the year. What will you do in your software? I suggest that you make a difference between the presentation layer and the storage layer. Give people what they want to see, but store the data unambiguously.

Finally, a practical tip: if you want to print Unicode characters in the Terminal on OS X, use a instance with an explicitly set encoding (instead of System.out). See “Print Unicode characters to the Terminal with Java” at Mac OS X Hints for the details.

EDIT: corrected Java date styles presented; they are “short” style, not “medium” style. Or Gangnam style.