简体   繁体   English

为什么我的'America / New_York'时区是php中的CWST时间

[英]Why is my 'America/New_York' timezone be a CWST time in php

date_default_timezone_set('America/New_York');

echo date('e').'</br>';

echo date('T').'</br>';

it output: 它输出:

CWST

America/New_York.

It Seems to be the system timezone set (+0845) (Australia/Eucla [CWST +08:45]) 似乎是系统时区设置(+0845)(澳大利亚/尤克拉[CWST +08:45])

I tried some other timezone and won't have this problem. 我尝试了其他时区,并且不会出现此问题。

I was unable to reproduce this. 我无法重现。 See output here . 在此处查看输出

If your system time zone is really "Australia/Eucla" , then I suppose that perhaps there's a bug in PHP. 如果您的系统时区实际上是"Australia/Eucla" ,那么我想PHP中可能存在一个错误。 The 45-minute offset might be part to blame. 45分钟的偏移可能是造成这种情况的原因。 But its very odd that it would affect the abbreviation. 但是很奇怪它会影响缩写。 If anything, I'd expect it to affect only the offset. 如果有的话,我希望它只会影响偏移量。

If this is a server we're talking about, you may want to consider setting the system time zone to UTC. 如果这是我们正在谈论的服务器,则您可能需要考虑将系统时区设置为UTC。 There aren't a lot of good reasons to localize the time zone of a server (of any kind). 没有足够的理由来本地化服务器的时区(任何类型)。

I suppose it's also possible that your copy of the time zone data is just corrupted. 我想您的时区数据副本也可能刚刚损坏。 You might try to re-install the timezonedb package from pecl. 您可能尝试从pecl重新安装timezonedb软件包

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM