Scooby08 Posted January 17, 2010 Share Posted January 17, 2010 I'm getting a timestamp from an xml feed that I'd like to display in proper date format, but I'm not quite sure how to read this one.. The xml gives a 13 digit timestamp like so: 1263708279364 Here's where I'm at: <?php echo date('m/d/y h:i:s',1263713664290); // 06/22/01 11:54:26 ?> Now if I remove the last 3 digits I get this: echo date('m/d/y h:i:s',1263713664); // 01/17/10 12:34:24 And that seems to be correct.. I guess the question is can the original timestamp that is given be formatted, or do I just have to remove the last 3 digits and call it good? Thanks!! Quote Link to comment https://forums.phpfreaks.com/topic/188763-timestamp-issues/ Share on other sites More sharing options...
oni-kun Posted January 17, 2010 Share Posted January 17, 2010 The timestamp is the time in seconds since January 1st, 1970 GMT. Removing three places = not such a good result. You should read up on time EDIT: You're right, The extra three numbers is most likely milliseconds (such as what the microtime gives) and should be safely able to be removed. Quote Link to comment https://forums.phpfreaks.com/topic/188763-timestamp-issues/#findComment-996490 Share on other sites More sharing options...
PFMaBiSmAd Posted January 17, 2010 Share Posted January 17, 2010 It the timestamp is in terms of microseconds since Unix Epoch, as it appears to be, instead of second since Unix Epoch, then removing the three least significant digits would be correct. Quote Link to comment https://forums.phpfreaks.com/topic/188763-timestamp-issues/#findComment-996493 Share on other sites More sharing options...
Scooby08 Posted January 17, 2010 Author Share Posted January 17, 2010 Alrighty guys!! Thanks a ton!! Quote Link to comment https://forums.phpfreaks.com/topic/188763-timestamp-issues/#findComment-996495 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.