【问题标题】:Find UTC time zone using offset使用偏移量查找 UTC 时区
【发布时间】:2017-10-18 16:26:30
【问题描述】:

我从 google API(https://maps.googleapis.com/maps/api/timezone/json?location) 找到 rawoffset。现在我想找到 UTC 时区而不是 UTC 时间。

例如:我有纽约市 rawoffset 和 Wana 来生成 UTC-5:00。

在 php 或 javacript 中可以吗?

【问题讨论】:

标签: javascript php


【解决方案1】:

您可以使用时刻时区。然后你可以像这样使用来获取时区

moment.tz([2012, 0], 'America/Denver').format('Z z');

它会产生结果 -> -07:00 MST

【讨论】:

  • 你必须包含 moment-timezone.js 并使用 moment.tz("America/New_York").format('Z z');.
猜你喜欢
  • 2014-02-04
  • 1970-01-01
  • 2018-03-01
  • 1970-01-01
  • 2011-03-01
  • 2016-05-07
  • 2013-10-15
  • 1970-01-01
相关资源
最近更新 更多