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 themy "php.ini" file of the PHP installation 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 correctlyincorrectly when I call the PHP
date()
following WordPress function in a standalone PHP script, and incorrectly when I call the function from within a plugin. - When I call(it is 4 hours behind what it should be):
date_default_timezone_getcurrent_time('Y-m-d H:i')
from within a plugin, it returns "UTC" even though my timezone is set to "New York" in WordPress' settings. - The above two bullets indicate that it's a WordPress issue.
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/