MM-DD or DD-MM?

Posted in: Technical Track

4 … I repeat 4 … 4 digits that can cause mass confusion. Was that April 3 or March 4? Being a database guy,  I have always had an ear to numbers. I was fascinated by those 10 digits from a very early age. A few years ago I stumbled into one of my most enjoyable podcasts courtesy of iTunes. It presented many examples of what it called “tricks” but were really just another way of doing things.

The traditional way of multiplying is done right to left. Picture 5*56. This is how we are used to doing it:

56
 5
--
First step:  5 = 5*6 (carry a 3) = 0 ;
Next step :  5*5 + the 3 we carried = 28
Final step:  stick the 0 on the end of the 28
ANSWER       280

Let’s look at an alternative method to doing the above calculation:

56
 5
--
(5*50) + (5*6) = 250+30 = 280

Was not that fun and different? Let’s try one more before moving on:

387
  8
---

(8*300) + (8*80) + (8*7) = 2400 + 640 + 56 = 3096

How is that relevant to the topic at hand? There is only one way to do something with numbers; only ONE way is right and ALL other are wrong. So why is it so complicated when numbers represent dates? Without worrying about the YYYY portion (yes 4 digit year –> remember that mess in the millenium?), is 1201 December 1 or January 12? Is 0708 July 8 or August 7? There are 12 days a year where this does not matter. 0101 is always January 1 and 1010 always October 10.

According to Wikipedia, at least one country in Europe insists on DD-MM format. Many more other countries use MM-DD. Need I say any more. How could we possibly let ourselves fall into this trap? It is beyond me how we allow ourselves to introduce complexities and confusion into a very simple concept … dates. Numbers have always been fun in my lifetime. One of the first number games we all may have played was at a very young age – multiplying a 1 digit integer by 9’s on our fingers.

Suppose each set of vertical lines below is a digit on your hand:

|  |  |  |  |      |  |  |  |  |
|  |  |  |  |      |  |  |  |  |

Let’s multiply 4*9. Start at the right and count 1, 2, 3, 4. That places us on the digit shown below with the * on top:

         *
|  |  |  |  |      |  |  |  |  |
|  |  |  |  |      |  |  |  |  |

Now put the designated digit down leaving

|  |  |     |      |  |  |  |  |
|  |  |     |      |  |  |  |  |

Count the digits up to the space (3) then the digits after (6). Lo and behold the answer is 36.

I always take for granted that 1204 means a certain thing when expressing a calendar date but have learned to not take everything for granted. The next time you see a 4 digit date think of me. Suffice to say, once past the 12th day of the month this becomes obvious. Enjoy the confusion and maybe your life will be as simple as mine, and things as mundane as the subject of this blog post will amuse you to no end :).

email
Want to talk with an expert? Schedule a call with our team to get the conversation started.

3 Comments. Leave new

Jeffrey Kemp
March 20, 2014 7:48 pm

Obviously the only right way to represent dates is DD-MM-YYYY or YYYY-MM-DD, like we do here in Australia :) MM-DD-YYYY, being neither big-endian nor little-endian, always looks strange to me.

Reply

Of course if there is a DATE datatype available, it should be used.
Then the data and the display values are separate.
With Oracle the data may then be displayed in any time format you like, as per the users preference.
Still, some developers are adamant about saving everything in a string, and then expressing wonderment that the database is ‘broken’.

Reply

Instead of 1204 I would choose Dec_4th_ or 12th_April ! Clear and no confusion ! May be I will add the year too. Years fly fast and some times we might need a backup older than a year !

Reply

Leave a Reply

Your email address will not be published. Required fields are marked *