The timezone-setting (in 'Settings' >> 'Generel' >> 'Timezone'), seems to be ignored. I've set it to be 'Copenhagen' (value:
But the servers time is still 1 hour ahead of the actual time in Denmark.
If I simply add these lines in the top of my functions.php-file:
$datetime = new DateTime(); $datetime_str = $datetime->format( 'Y-m-d H:i:s' ); error_log( $datetime_str );
Reload a random page and go to my error-log, then I get this result:
[24-Mar-2021 16:12:08 UTC] 2021-03-24 16:12:09
But if if add replace above-written three lines with this:
date_default_timezone_set ( 'Europe/Copenhagen' ); $datetime = new DateTime(); $datetime_str = $datetime->format( 'Y-m-d H:i:s' ); error_log( $datetime_str );
Then it outputs this:
[24-Mar-2021 17:12:13 Europe/Copenhagen] 2021-03-24 17:12:13
'Europe/Copenhagen' -> Yep. And the time is correct as well.
And if I try to set it to some other value (like 'UTC+8'), then it still says:
[24-Mar-2021 16:12:08 UTC] 2021-03-24 ... in the debug-log.
It could be somewhere in my theme or in a plugin. But it seems excessive to start to deactivate all plugins and set another theme, just to debug this minor thing.
So my question is:
- Is it a big performance-hit, to leave my fixing line in the top of the functions-file:
date_default_timezone_set ( 'Europe/Copenhagen' );
- Can anyone figure out, why the timezone is set to UTC instead of what the value I've set in the WordPress-settings-page?