Saturday, June 14, 2008

Download Firefox 3 Tuesday, June 17th and Set a World Record

The best browser in the world gets even better. And if you download it on Tuesday, June 17th, you can help set a world record. Go here http://www.spreadfirefox.com/en-US/worldrecord/ for more details.

Thursday, June 12, 2008

PHP Date Limit for Unix Timestamps

So the other day I discovered another one of those weird limitations that I never would have thought existed. Apparently the PHP date function, which formats a Unix Timestamp to a user input format, only accepts a specific range of Unix Timestamps. It's funny because I never would have discovered this, but by accident. The following is actually quoted from php.net
The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer). However, before PHP 5.1.0 this range was limited from 01-01-1970 to 19-01-2038 on some systems (e.g. Windows)
Of course this isn't for another 30 years, but what about applications that use future dates? It doesn't make much since to me, because I always thought the Unix Timestamp was perfect to simplify the process of making dates readable across multiple regions and format preferences. But it seems that it may not be the best solution to store dates. But it does seem that much of the internet is already so dependent on it. Unless you create your own date/time conversion functions, you are probably using strtotime, time and date functions.

Another thing that confused me, when I discovered this issue by accident, I noticed that what the date function returns for values over the 2147483647 integer max, if you pass it as a string, it gives you a different date output. This doesn't occur when given a value within the acceptable range.

Anyway, I thought it was interesting, and I'm sure before the next 30 years pass, we will be running 256-bit systems and the limitations of our current 32-bit systems will be nill. In the meantime, it looks like applications that require higher date ranges will be better off using another date format like the MySQL Current Timestamp, with some conversion functions to make the dates more human readable.