The era today is 3 years

I get an era returned from a web service that is about 3 years old in PHP, but works fine in javascript and epochconverter.com

JS:

alert ('book' + new Date (1285565357893)); // returns the time this morning on Sep 27, 2010, right!

PHP:

echo strftime ('% x', 1285565357893); // returns the date in 2013, Wrong!

The time zone is set to: Europe / Amsterdam

What am I doing wrong here?

+3
source share
1 answer

Ok, some simple time basics for you.

Javascript date class ... when you pass a numeric value to the constructor, this is the number of milliseconds since Unix Epoch (January 1, 1970 00:00:00 GMT)

PHP Unix Epoch (1 1970 00:00:00 GMT).

PHP 1000.

echo strftime('%x', floor(1285565357893/1000));
+6

Source: https://habr.com/ru/post/1766739/


All Articles