3

http://www.meetup.com/meetup_api/docs/2/event/

Meetup API の時間の定義は次のとおりです。

エポックからのミリ秒単位のイベント開始時間、または d/w/m 形式の現在の時間に対する相対時間。

JSONで返される値のタイプは次のとおりです。

"time": 1382742000000,

それを認識可能なものに変換する方法について何かアドバイスはありますか?

4

3 に答える 3

4

このような日付オブジェクトを作成できます

var date = new Date(milliseconds);

Dateそして、プロパティを使用して、必要な形式を適用できます

于 2013-10-25T18:23:17.593 に答える
2

これを試して

// 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;
于 2013-10-25T18:23:09.870 に答える