I'm using the following code to display dates returned from a query of a mySQL database.
What kind of field is it? (int,timestamp,datetime,etc)
$new_timestamp = strtotime($row_SearchPlayerRcrdSt['Date']);
what do the following contain:
$new_timestamp $row_SearchPlayerRcrdSt['Date']
you also might want to try connecting to the DB with the cmdline mysql app to take a look at the date values actually stored in the DB.
$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?
Sounds like you have yet to come across the 'unix epoch' (try googling that). something to do with this looks to be tripping you up.
Either the date in the DB is invalid (eg. equal to 0) or strtotime or date are truncating the date value in your version of php.
(what version of php & mysql?)
Also notice that you are taking a formatted date string, parsing it for a timestamp and then creating a new formatted date string. Why not let mySQL just format it how you want straight away and save 2 function calls?
Thanks, Frank
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php