Re: Dates prior to Dec 31, 1969

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 14 Dec 2004 15:39:52 -0600, Frank Marousek
<frank@xxxxxxxxxxxxxxx> wrote:
> I'm using the following code to display dates returned from a query of a
> mySQL database.
> 
> $new_timestamp = strtotime($row_SearchPlayerRcrdSt['Date']);
> $new_date_formatted = date ("m/d/y", $new_timestamp);
> echo $new_date_formatted;
> 
> It appears that all dates prior to Dec 31, 1969 are displayed as 12/31/69.
> 
> What am I doing wrong?
> Thanks,
> Frank
> 

On my system it displays at 01/01/70. This may be related to that note
in the strtotime page of the php manual:

http://ww.php.net/manual/en/function.strtotime.php

----
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.
----

How about letting MySQL format the date for you? 
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html#IDX1384


----
ramil
http://ramil.sagum.net

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux