Does php date_default_timezone_set set daylight saving time?

Does php date_default_timezone_set support daylight saving time?

I have this code and am wondering if it will always lead to the correct Stockholm time?

date_default_timezone_set('Europe/Stockholm'); $timestamp = date("Ymd H:i:s"); 
+7
source share
3 answers

Yes, this should always lead to the right time.

+2
source

As long as your time zone is listed in the following link, the timestamp should be relative to the correct time zone.

http://www.php.net/manual/en/timezones.php

+2
source

PHP does not automatically handle DST. You have to check

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

Then you should increase the time accordingly. (Note: ā€œIā€ is in equity. I just checked it and it works.)

0
source

All Articles