Reputation: 193
I have the following timestamp: 2842214400
Using the online conversion tool http://www.onlineconversion.com/unix_time.htm This gives the date of
Sun, 25 Jan 2060 00:00:00 GMT
However using the following code:
$timestamp = 2842214400;
print date("Y-m-d H:i:s", $timestamp);
In PHP 5.6.30 gives a result of 1923-12-19 17:31:44
In PHP 7.0.15 gives a result of FALSE
What am i doing wrong here? Neither PHP results are what i would expect?
Upvotes: 2
Views: 66
Reputation: 1750
Run:
var_dump(PHP_INT_SIZE === 8;
If it returns TRUE, use the DateTime class (http://php.net/manual/en/class.datetime.php) instead of the standard date functions.
If it returns FALSE, you are running a 32-bit version of php. You either need to switch to 64-bit or use an outside library like ADO (http://phplens.com/phpeverywhere/adodb_date_library).
Upvotes: 1