While debugging a plugin I was writing, I noticed that on line 36 of wp-settings.php, the default timezone is hardcoded to UTC with a call to the date_default_set_timezone() function. This means any call to the PHP date/time functions will work with UTC as the local time.

Can someone please explain to me why this is a sane design choice by the Wordpress team? I understand if they want to store and manipulate times internally as UTC, but wouldn't a better alternative be to explicitly switch to a "UTC mode" when they need to do such logic?

Assuming you know to set your server's php.ini's timezone setting, this hardcoded UTC basically invalidates php.net's description of the date() function:

date — Format a local time/date

Which strikes me as a bad thing, no?

2 Answers 2


Somehow I missed the current_time function, which gives a good description of the situation and how to properly deal with the need to get the current blog-local time.


Though the purist in me still hates how WP makes the time zone setting in php.ini obsolete without giving you a choice. *grumble grumble*

  • 1
    I have extensive theme and plugin code that uses date() and relies on a properly set PHP timezone, and only now I discover that the reason some WordPress dates look wrong is because it requires that I never touch the PHP default timezone. Yuck. Commented Jun 20, 2018 at 5:57

WordPress is not a simplistic script, it is a extensive web app. It includes own time zone settings and own functions for output of localized date/time info.

I suppose it is much more straightforward to set baseline time zone and operate on top of that, than trying to change it back and forth around all related functionality.

  • 2
    Oh I get that we're making some fundamental changes to the environment when WP runs, and all code should be viewed in the context of running within the Wordpress framework. I just don't think it's very intuitive to change a fundamental assumption about a set of oft-used PHP functions with a mandatory hardcoded statement.
    – Gregarious
    Commented Oct 13, 2011 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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