How Do I Convert The "time" From The Meetup API To A Recognizable Format?
http://www.meetup.com/meetup_api/docs/2/event/ Here's the Meetup API's definition of time: Event start time in milliseconds since the epoch, or relative to the current time in the
Solution 1:
You can construct a date object like this
var date = new Date(milliseconds);
And then you could apply any format you want using Date
properties
Solution 2:
Try this
// Convert milliseconds since since 00:00:00 UTC, Thursday, 1 January 1970 (the epoch in Unix speak)
var date = new Date(1382742000000);
// now get individual properties from the date object to construct a new format
// hours part from the timestamp
var hours = date.getHours();
// minutes part from the timestamp
var minutes = date.getMinutes();
// seconds part from the timestamp
var seconds = date.getSeconds();
// display time in our new format
var formattedTime = hours + ':' + minutes + ':' + seconds;
Solution 3:
moment.js library can help very well
moment(1382742000000) will give you object and inside of it you can see:
Fri Oct 25 2013 19:00:00
Post a Comment for "How Do I Convert The "time" From The Meetup API To A Recognizable Format?"