### 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

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 :).

Interested in working with Michael? Schedule a tech call.

#### Michael S. Abbey

Michael is a seasoned veteran of the Oracle core technology having first seen version 3 in 1986. He is a regular presenter at tech and user group events and has been a popular speaker since 1991. He was part of the initial Oracle Press offering in 1994 called Tuning Oracle and has gone on to accumulate quite a following on the Beginner's Guide books. Michael is an Oracle*ACE based on his profile and accomplishments in the Oracle space and can be followed as @MichaelAbbeyCAN on Twitter.He is father to 4 and grandfather to 3 and likes nothing more than discussing the Oracle technology and/or listening to or jamming hard classic rock.

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.