On the “General Settings” page of my WordPress site, it’s not displaying the correct UTC and local times (see screenshot below).
The displayed UTC and local times are wrong. It should say that local time is “15:52”
- I’m running WordPress 4.9.6 and PHP 7.0.30.
- The default timezone in my “php.ini” file is set correctly–when I call the
date()
anddate_default_timezone_get()
functions from a standalone PHP script, they output the correct information. - The clock on my Windows web server is correct and is set to the correct timezone.
- The time displays incorrectly when I call the following WordPress function (it is 4 hours behind what it should be):
current_time('Y-m-d H:i')
.
This thread says the problem is caused by a bad plugin. I actually had that particular plugin installed, but deactivating (and then deleting) the plugin didn’t fix the issue for me.
This thread says it’s due to the server’s timezone definitions being corrupted. It provides instructions on how to fix this for Linux, but not Windows. However, I have other WordPress sites hosted on the same server, and they do not have this issue.
Issue has been cross-posted here: https://wordpress.org/support/topic/timezone-settings-utc-and-local-times-are-incorrect/
1 Answer
This is set inside your database and is also used inside PHP settings on the server. Double check the PHP settings if you can control them. There is a timezone parameter that you can enter into PHP.ini (PHP -v shows you all of this). For MySQL… You’d need to look at global setting which I’m forgetting at the moment.