gpt4 book ai didi

javascript - 在 Javascript 中将时间戳转换为不同时区的值

转载 作者:行者123 更新时间:2023-11-28 17:35:03 25 4
gpt4 key购买 nike

我有来自 API 作为对象的不同时间戳和时区。示例:

{{'ts' : 1521311400000},
{'tz' : 'GMT+01:00'}}

如何使用 toLocaleTimeString() 将时间戳转换为该时区中人类可读的日期?我尝试将 options 对象内的时区作为 timeZone 的值传递,如 here 所示。但我在 DateTimeFormat() 中收到 无效时区 错误,并且无法弄清楚正确的格式应该如何。

最佳答案

要获得这种格式化日期的灵 active ,您可能需要查看 MomentMoment Timezone .

关于javascript - 在 Javascript 中将时间戳转换为不同时区的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49330576/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com