Dates Are Difficult
Written by Mike James   
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!

 

milleniumbug

 

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.

 

unixdate

 

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.

 

blog comments powered by Disqus

 
Banner


Programmer's Introduction to XML

XML is a general purpose markup language that can be used to control the structure of data. Despite the fact that many prefer the simplicity of JSON it still has many advantages. What makes it so good [ ... ]



Codd and his Rules

Theories of how we should organize databases are thin on the ground. The one exception is the work of E.F. Codd, the originator of the commandment-like “Codd’s Rules”. This approach to database  [ ... ]


Other Articles
 

<ASIN:0879304960>

<ASIN:0521702380>

<ASIN:0380793245>

<ASIN:0070211205>



 
 

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