1

Problem is the one several post already has displayed : I've updated one of our wordpress from 4.6.1 to last version. Local time of server is not UTC and WordPress inside general options show a UTC time equal to server local time instead of server UTC time (and of course, local time displayed by Wordpress is also shifted).

All the post I've read say the same thing : server needs to be in UTC. For several reasons (main is we have a lot of websites on this server, all of them not running on WP), we don't want to modify the time of server to be in UTC.

Is there a possibility to "tell" to WordPress that the time it thinks UTC is not UTC but in a local timezone ?

Any idea to solve this problem ?

Thanks

0

your post is very old, but in case someone gets the same issue.

Even if your server is set to date_default_timezone_set('America/New_york'); When Wordpress runs, it rewrite the config to date_default_timezone_set('UTC') to store datetime in UTC, which is the Universal Time without offset.

Usually, when I compare a date to now, I use the variable $_SERVER['REQUEST_TIME']. But this variable is not converted.

I found out that instead of using that variable, I should use the wordpress function current_time('U'), which will reflect the current time with offset accordingly to my Wordpress Setting.

Hope that could help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.