Dates Are Difficult
Dates Are Difficult
Written by Mike James   
Wednesday, 21 August 2013
Article Index
Dates Are Difficult
Hot Dates
Date Bugs

Date Bugs

What is amazing is that even after all this work we can still make a mess of working with dates. All you need to do is to try and tackle a problem that involves a time that takes you past midnight to see what I’m getting at!




If you think that the millennium bug, when we all thought that the computer world would come to an end when the year date rolled over, was the last date crisis then you need to think again.

This particular problem was caused by many programs, not expected to last to the turn of the century, simply not storing the century part of the date and was entirely obvious and easy to avoid. There are much more subtle ways of making a mess of dates and times that are just as serious and much more difficult to fix.

By the way, the next big date bug is expected in 2038 when the Unix 32 bit time stamp rolls over to 0. Given that the Unix time and date system works by simply counting the seconds since the 1st of January 1970 using a 32 bit integer there is a most future date. The largest positive 32-bit integer represents a date of Tuesday 19th of January 2038 - and after this time all Unix time stamps will roll over and look like dates back in 1901.

Why 1901?  

A Unix date/time is a signed 32-bit number, so you can use negative seconds, which give dates and time before 1970. Using the largest 32-bit negative number gives a date of Friday 13th in December 1901 as the earliest Unix date. So if you try to book something in 2038 be prepared for it to happen in 1901.




Related Articles


Azure Outage - Date Arithmetic Details

Leap Year Gotcha for Azure

Speed dating - the art of the JavaScript Date object

Calculating with dates in Excel 2003     

Monthly Calendar

Cartoon - Why 1970? or Dating Troubles

The Mod function


To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, FacebookGoogle+ or Linkedin,  or sign up for our weekly newsletter.






or email your comment to:


What Is Computable?

Performing a computation sounds like a simple enough task and it is easy to suppose that everything is computable. In fact there are a range of different types of non-computability that we need to con [ ... ]

Finite State Machines

Finite state machines may sound like a very dry and boring topic but they reveal a lot about the power of different types of computing machine.  Every Turing machine includes a finite state machi [ ... ]

Other Articles





Last Updated ( Wednesday, 21 August 2013 )

RSS feed of all content
I Programmer - full contents
Copyright © 2018 All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.