What do I put in date_default_timezone_set?

2019-09-18 19:46发布

I'm not from the US but I want to use date_default_timezone_set and set it to Englewood, Colorado. What do I use? I can't find any America/Englewood or America/Colorado in the documentation. Any help?

标签: php timezone
2条回答
爷的心禁止访问
2楼-- · 2019-09-18 20:26

As google tells me that Colorado is in the 'Mountain Time Zone' use US/Mountain from the documentation

查看更多
迷人小祖宗
3楼-- · 2019-09-18 20:28

The correct TZDB zone name is America/Denver.

US/Mountain is an alias that presently resolves to America/Denver, but it may not always be that way in the future.

The US/* aliases are there for backwards compatibility only, and do not follow the normal naming conventions of the IANA/Olson time zones that PHP uses.

From the PHP documentation:

Warning

Please do not use any of the timezones listed here (besides UTC), they only exist for backward compatible reasons.

See also: Are 'US/Eastern' and 'US/Central' and 'US/Pacific' deprecated for strftime or just PHP?

查看更多
登录 后发表回答