This is a pretty frustrating issue for plugin development.
1. The server is set to America/Chicago.
2. php.ini sets the TZ to America/Chicago.
3. WordPress -> Settings -> General -> Timezone is set to America/Chicago.
A simple plugin that takes a user-input Y-m-d H:i:s date/time and then displays it somehow always ends up in UTC.
Why? Because wp-settings.php sets the timezone to UTC.
So anytime your plugin code is going to do anything with date/time you always have to call date_default_timezone_set( get_option( ‘timezone_string’ ) ) first.
I don’t want to start a religious war, I just want to understand why WP would give the blog admin the ability to set a timezone in the settings and then force UTC anyway. The reasoning escapes me.
Thanks for all your great explanations!
- The topic ‘Why does wordpress set timezone to UTC?’ is closed to new replies.