PHP date_default_timezone_set() 从 GMT 偏移量是可能的


PHP date_default_timezone_set() from GMT offset is possible?

PHP date_default_timezone_set() 从 GMT 偏移量是可能的吗?

im mySQL db 我有:

|timezoneid  |  gmt_offset  |  dst_offset |  timezone_code | zone_name
|    1       |    -12       |     0       |      NULL      |    (GMT-12:00) International Date Line West

我希望能够从数据库中设置时区

检查DateTimeZone::listAbbreviations()的输出,它为您提供了支持的时区和相应偏移量的完整列表。您应该自己检查确切的输出,因为您将获得嵌套数组。

另请注意,并非所有时区都有与 UTC 的确切整小时偏移量,某些地区也会增加 30 或 45 分钟。