【发布时间】:2018-11-25 11:32:18
【问题描述】:
我已将 UTC 时间的属性保存为 N 小时(例如时间:15),现在我想将其转换回自定义时区。
我想使用 moment js 并将这 15 H 从 UTC 时区转换为自定义时区(例如:欧洲/柏林)
首先我从 Europe/Berlin 转换为 UTC:
hours = 15
moment.tz(hours, "HH", "Europe/Berlin").utc().format("HH")
这在数据库中保存为 13。 现在我想将 13 小时从 UTC 转换回 Europe/Berlin。
自定义时区(欧洲/柏林)是动态的。
有什么帮助吗?
【问题讨论】:
标签: javascript timezone momentjs utc