gpt4 book ai didi

javascript - 如何在 Javascript 中使用 toISOString()?

转载 作者:行者123 更新时间:2023-12-02 19:05:41 26 4
gpt4 key购买 nike

我正在使用 currentDate.toISOString(),它以“2013-01-15T12:08:54.135Z”格式提供输出。

但我需要日期格式为“2013-01-15T12:08:54-06:00”。

这里 -06:00 可能是时区。

最佳答案

此函数仅构建 ISO 格式的字符串,如 ISO 8601 所定义。 .

要构建不同格式的字符串,您可以

date.js 有一个方便的 toString功能。您可以使用many identifiers ,如果您导入extras.js ,其中

P Difference to Greenwich time (GMT) with colon between hours and minutes "+02:00", "-06:00"

关于javascript - 如何在 Javascript 中使用 toISOString()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14337591/

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