does php's date_default_timezone_set adjust to daylight saving?

前端 未结 3 835

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?



        
相关标签:
3条回答
  • 2021-01-05 04:40

    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

    0 讨论(0)
  • 2021-01-05 04:48

    Yes this should always result in the right time.

    0 讨论(0)
  • 2021-01-05 05:03

    PHP doesn't handle DST automatically. You have to check

    if (date('I', time()) == 1) ... the time is in DST mode ("0" = not)
    

    Then you should adust time accordingly. (Note: 'I' in capital. I have just checked it and it works.)

    0 讨论(0)
提交回复
热议问题