views:

131

answers:

0

So, $logarray[$row]["time"] is fetched from a MySQL table and placed into an array. The value is stored as a 10 digit int. When I try to pass it into the second parameter of date(), it tells me its expecting a long type, not a string type. So, I tried casting it into an int (couldn't find a long caster...). The error went away, but now it shows all the times to be in December 1969 (ie, beginning of the Unix epoch). I can't figure out why it won't display correctly.

$time = intval($logarray[$row]["time"]);
$timestamp = date( 'Y-m-d H:i:s', $time);

When var_dump()ing the array, the time called looks like this:

["date"]=>
string(10) "1271772595"