Reputation: 1169
Can anyone please explain me this weird behaviour of these timestamps? There's an application that converts the timestamps to dates like this:
1184947071570 - 07-20-2007 11:57
1190394533377 - 09-21-2007 13:08
I cannot access the source code of that application. But I got the timestamps from the database, and when I convert to date using php this is what happens:
1184947071570 - 20 April 1955 13:17:54
1190394533377 - 27 October 1991 14:39:45
I used this code in php:
date("l, j F Y H:i:s", $timestamp)
The dates are completely different! How can I get the correct dates??
Thank you.
Upvotes: 1
Views: 1568
Reputation: 24276
I've just made some tests and your db timestamp has some additional characters.
Timestamp for 07-20-2007 11:57
is 1184947020
Upvotes: 0
Reputation: 5065
The timestamps you have include milliseconds. If you divide your timestamps by 1000 you will get the correct times.
echo date('l, j F Y H:i:s', 1184947071570 / 1000);
Upvotes: 8
Reputation: 1149
They are not seconds like UNIX timestamps.
They are milliseconds devide it by 1000 and try again
Upvotes: 2