Reputation: 23574
I have the following timestamp:
1341111034380
Which equates to:
Sun, 01 Jul 2012 02:50:34 GMT
However, when I try to format this using:
date("F j, Y, g:i a", 1341111034380)
I get:
February 12, 44468, 5:53 am
Any ideas why it would do this?
Upvotes: 1
Views: 413
Reputation: 39724
use:
echo date("F j, Y, g:i a", substr(1341111034380, 0, 10));
Upvotes: 0
Reputation: 161637
You have the wrong units.
1341111034380 is in milliseconds, whereas a proper timestamp is in seconds, which is what PHP expects.
If you want to use it in PHP, you should convert it to seconds.
echo date("F j, Y, g:i a", floor(1341111034380/1000));
Upvotes: 8