【问题标题】:Moment timestamps === utc?时刻时间戳 === UTC?
【发布时间】:2018-09-24 19:07:27
【问题描述】:

时刻时间戳是否始终采用 UTC?我对库做了一些操作,moment(ts).unix() 返回与 moment(ts).utc().unix() 相同的值。

有没有办法获取本地时间戳?

【问题讨论】:

  • 时间戳值始终是相对于 UTC 时间固定点的偏移量。
  • 特别是,Unix Timestamps 来自 UTC。
  • UNIX 时间戳为 by definition,始终以 UTC 表示。

标签: javascript time momentjs


【解决方案1】:

直接来自 Moment.js front page

console.log(moment(1410715640579).format('LLL'))
<script src="https://momentjs.com/downloads/moment.js"></script>

【讨论】:

    猜你喜欢
    • 2016-07-12
    • 2018-11-17
    • 2012-07-24
    • 1970-01-01
    • 2015-12-09
    • 2011-09-01
    • 2016-07-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多