gpt4 book ai didi

PHP:为什么 timezone_name_from_abbr 不能使用 8 的 GMT 偏移量?

转载 作者:可可西里 更新时间:2023-11-01 13:12:13 25 4
gpt4 key购买 nike

我正在尝试使用 timezone_name_from_abbr()偏移量为 GMT+0800,但它不返回预期的时区:

echo "timezone =" . timezone_name_from_abbr('', 8 * 60 * 60, 0) . '<br/>';

根据文档,这应该有效:

If abbr doesn't exist then the time zone is searched solely by the gmtOffset and isdst.

我做错了什么? GMT+0800 是 Asia/Singapore 的有效时区。

最佳答案

这不是一个很花哨的答案,但它是一个已经存在了很长一段时间的错误 (Bug #44780 - some time zone offsets not recognized by timezone_name_from_abbr)。

基本上,这个特定的时区(和 some others )只会在您传递缩写时解析为名称,而不管文档怎么说。

顺便说一句,在函数无法解析名称的情况下,返回值为 false

关于PHP:为什么 timezone_name_from_abbr 不能使用 8 的 GMT 偏移量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17788650/

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