Dates in javascript are numeric milliseconds since January 1, 1970. Facebook dates (at least creation_time and update_time in the stream table) are in seconds since January 1, 1970, so you need to multiply by 1000. Here is the code for doing this for posting on my wall earlier ( fiddle ):
var created_time = 1276808857; var created_date = new Date(created_time * 1000); var current_date = new Date(); console.log('Post: ' + moment(created_date).format()) console.log('Now: ' + moment(current_date).format());
Result:
Post: 2010-06-17T16:07:37-05:00 Now: 2013-11-12T16:37:01-06:00
I used the code here to format dates: http://momentjs.com/
source share