The Problem with Dates

TL;DR: Just a few days ago, it was 20/04/12.

At a previous organization, I spent eight years building software that handled dates and times for scheduling, and I learned a great deal about timezones, date formats, and a bunch of other stuff most folks won’t care too much about.

Dates are stored and represented in many ways, in many languages. Here’s an example in the United States, in English:

Today is April 12th, 2020.

Today is 04/12/2020

We like to write things Month/Day/Year. This makes no sense and is stupid. Sorting the dates will never get you a good sort. It would be like writing the number 123 as 231. The most significant measurement (year) should be first. Then month, second. And then finally day.

We do this with time. Hours, Minutes and then Seconds.

Some countries do little-endian, so the smallest unit is first:

Day/Month/Year

Others do big-endian, or biggest first:

Year/Month/Day

Or, the United States (who still measures using a body part), mixed-endian:

Month/Day/Year

Let’s Just All Agree on a Format

It’s not that easy. Even if I could have my way, and everybody wrote dates 2020.04.12 (for April 12th, 2020), there are other folks in the world who may read this as “December 4th, 2020”

Even still, we can’t eliminate the ambiguity with words either. Today is 12-Apr-2020.

But not everybody calls it April. And 12-Apr-20 is just as bad as where we started.

History Makes This Worse

Even if we did standardize on a format, looking back in time we’ll see different regions of the world (and migrants from those parts) representing dates differently. What this means is, if we standardize on a format we still will have historical inaccuracies when these dates align. Think back to May 5th, 2005. That’s 05/05/05. Easy to work out. What about May 6th, 2005. Where do I place the “06”?

We’ve Standardized and Purged History, but…

I got my way! Everybody is comfortable to using 2020.04.12 for today, and no historical texts exist that would allow this format to be confusing. We all know it as YYYY.MM.DD. Easy.

Dates are just as subject to timezones as times themselves. We have no idea what timezone this is. Do we normalize to UTC? What is UTC v. GMT? Do people really know? And if so, do we include local daylight savings time? Do we put a character at the end to signify this? 2020.04.12U?

Timestamps

A great example of timestamps is the Unix Timestamp. This is the count of seconds since Jan 1st, 1970. The problem with that is it ends on a 32-bit system in 2038 (that’s right folks, we’re 18 years from a new Y2K problem).

So storing that information is difficult as well.

BTW, That date? “Yi You 乙 酉” is how they represent that in China.

The Solution!

I don’t have one, I’d love to see what folks think though — and other problems I’m missing here as well.

Oh, and if I didn’t mention it, COVID-19. It’s the cool thing every blog is mentioning these days.

About Author


Robert Lerner

Leave a Reply

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