PHP碳开关时区偏移量

问题描述 投票:0回答:1

使用PHP7.3和nesbot / carbon 2.19.0,我运行以下代码:

$dt = new Carbon('2019-04-08T04:12:38.000000+00:00', 'UTC');
$local = $dt->copy()->setTimezone('Etc/GMT-9');
$formatted = $local->toISOString(true);

现在我看到$ formatted现在等于'2019-04-08T13:12:38.000000 + 09:00'。为什么我的时区偏移现在为正?不应该是负面的吗?奇怪的是,如果我设置了TimeTimezone('Etc / GMT + 9'),那么我的偏移就变成了负数。我是不是误会了这个,如果不是,关于如何解决它的任何建议?

php php-carbon timezone-offset
1个回答
0
投票

结果正确。 Etc / GMT-9的偏移量为+09:00。 See List of tz database time zones

© www.soinside.com 2019 - 2024. All rights reserved.