php 的 date_default_timezone_set 是否会调整为夏令时?
php的date_default_timezone_set是否调整为夏令时?
我有这段代码,想知道它是否总是会产生正确的斯德哥尔摩时间?
date_default_timezone_set('Europe/Stockholm');
$timestamp = date("Y-m-d H:i:s");
Does php's date_default_timezone_set adjust to daylight saving?
I have this code, and wonder if it will always result in the correct Stockholm time?
date_default_timezone_set('Europe/Stockholm');
$timestamp = date("Y-m-d H:i:s");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
PHP 不会自动处理 DST。你必须检查
然后你应该相应地调整时间。
(注:“I”大写。我刚刚检查过,它有效。)
PHP doesn't handle DST automatically. You have to check
Then you should adust time accordingly.
(Note: 'I' in capital. I have just checked it and it works.)
是的,这应该总是在正确的时间产生。
Yes this should always result in the right time.
只要您的时区在以下链接中列出,时间戳就应该相对于正确的时区。
http://www.php.net/manual/en/timezones.php
As long as your timezone is listed in the following link, timestamp should be relative to the correct timezone.
http://www.php.net/manual/en/timezones.php