Reputation: 13
Is there a way to parse an integer generated from ruby's Time class (with gmt) to a date in PHP?
Here's an example:
int : 1463616000000
When I tried to parse it with this code:
echo date('Y-m-d', 1463616000000);
The output is:
48350-02-22
Upvotes: 0
Views: 47
Reputation: 17433
Ruby's Time class returns a timestamp in miliseconds rather than seconds. Just divide by 1,000 for PHP:
$ts = 1463616000000;
$ts /= 1000;
echo date('Y-m-d', $ts); // 2016-05-19
Upvotes: 2