gpt4 book ai didi

javascript - getTimezoneOffset() 方法

转载 作者:行者123 更新时间:2023-12-03 06:03:17 24 4
gpt4 key购买 nike

getTimezoneOffset() 方法返回UTC 时间本地时间之间的时差(以分钟为单位)。

如果我在加利福尼亚州,并且使用的太平洋标准时间,比 (GMT -8)(GMT -7) 晚 8 小时日期灯节能。

getTimezoneOffset() 方法不是应该返回 -420min 而不是 420min 吗?

最佳答案

getTimezoneOffset() 返回相对于当前时间的偏移量,因此如果您落后,您将得到正结果。

Description

The time-zone offset is the difference, in minutes, between UTC and local time. Note that this means that the offset is positive if the local timezone is behind UTC and negative if it is ahead. For example, if your time zone is UTC+10 (Australian Eastern Standard Time), -600 will be returned. Daylight saving time prevents this value from being a constant even for a given locale.

来源MDN

关于javascript - getTimezoneOffset() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39662249/

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