Re: [Q] Converting SQL Datetimes to timestamps
| From: | John Nichel | Date: | Tue, 03 Aug 2004 18:24:12 +0000 |
| Subject: | Re: [Q] Converting SQL Datetimes to timestamps | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-192579@lists.php.net to get a copy of this message | ||
On Tuesday 03 August 2004 14:05, Michael T. Peterson offered up the
following tid-bit of information :
> Evidently the strtotime() function will not convert an SQL datetime to a
> timestamp. Am I missing something? Here's an example of what I mean:
>
> $sql_datetime = '1948-30-03 01:30:00';
> $ts = strtotime( $sql_datetime );
> print( $ts.'<br>');
>
> When this script is executed, strtotime() returns -1.
>
> If true, that strtotime() is unable to convert SQL datetimes into
> timestamps, how are others accomplishing this?
>
> Cheers,
>
> Michael
It works with SQL datestamps....just not with that one above. The year
(1948) will return a negative timestamp....
<quote from http://us4.php.net/strtotime>
Note: 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.)
Additionally, not all platforms support negative timestamps, therefore your
date range may be limited to no earlier than the Unix epoch. This means
that e.g. dates prior to Jan 1, 1970 will not work on Windows, some Linux
distributions, and a few other operating systems.
</quote>
--
John C. Nichel
ÜberGeek
KegWorks.com
716.856.9675
john@kegworks.com