使用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'),那么我的偏移就变成了负数。我是不是误会了这个,如果不是,关于如何解决它的任何建议?
结果正确。 Etc / GMT-9的偏移量为+09:00。 See List of tz database time zones。