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.
No comments:
Post a Comment