MomentJS - Unix 時間戳



使用此方法,你可以以毫秒和秒為單位傳入整數值到 moment。

語法

moment(Number);

示例

var day = moment(1315681876406);

輸出

Unix Timestamp

要使用 moment 中的秒,必須將它用作 moment.unix(timestamp)

語法

moment.unix(Number)

示例

var day = moment.unix(1968781876);

輸出

moment.unix(timestamp)
momentjs_parsing_date_and_time.htm
廣告
© . All rights reserved.