如何获得独立于设备的UTC时间?

时间:2021-03-07 07:11:12

标签: javascript node.js date npm momentjs

我在 node.js 中工作,我有两种情况:

  1. 获取当前的UTC时间
  2. 获取以本地时间设置的未来日期的 UTC 时间。 我必须将这两个时间都转换为我的当地时间。我可以使用 javascript new Date() 和 moment.js .tz() 函数来实现这一点。但是 new Date() 依赖于机器。我遇到了 this link,这表明我们甚至不能相信 moment.js 我可以使用什么来获得独立于设备/服务器的 UTC 时间。

0 个答案:

没有答案