I am trying to convert a mysql DATETIME into this format m/d/y but the code below is not working, returns 12/31/1969 instead can someone show me how to do this?
$fromMYSQL = '2007-10-17 21:46:59'; //this is the result from mysql DATETIME field
echo date("m/d/Y", $fromMYSQL);
I think what you really want is this:
The second argument of date is a timestamp and I think what is happening is PHP sees your string as a -1 timestamp… thus 12/31/1969.
So, to get a timestamp from the string version of the date, you use strtotime