3

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 d/w/m format.

Here's the type of value I see returned in the JSON:

"time": 1382742000000,

Any advice about how to convert it into something recognizable?

whoan
  • 8,143
  • 4
  • 39
  • 48
LNA
  • 1,427
  • 3
  • 24
  • 37
  • possible duplicate of [Converting milliseconds to a date (jQuery/JS)](http://stackoverflow.com/questions/4673527/converting-milliseconds-to-a-date-jquery-js) – Bucket Oct 25 '13 at 18:22
  • var dt = new Date(1382742000000) this will give you date object & to display it use this dt.toString() this will gives you an output "Sat Oct 26 2013 04:30:00 GMT+0530 (India Standard Time)" – Sohil Desai Oct 25 '13 at 19:14
  • If you are using python, datetime.datetime.fromtimestamp(ms/1000.0) works. I know this question is for javascript, but this is the first post to come up on google. – user1876508 Feb 12 '14 at 22:28
  • Just in case anyone using a different language needs to know: the "epoch" here is the same as the Unix epoch, named "01 Jan 1970 00:00:00 UTC" –  Nov 10 '15 at 22:34

3 Answers3

4

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

Claudio Redi
  • 67,454
  • 15
  • 130
  • 155
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;
oligofren
  • 20,744
  • 16
  • 93
  • 180
Kishore
  • 1,914
  • 1
  • 15
  • 22
1

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