[wp-trac] [WordPress Trac] #39595: date_default_timezone_set in wp-settings.php is set prematurely and ignorantly, regardless of other defined settings

WordPress Trac noreply at wordpress.org
Tue Mar 27 13:06:49 UTC 2018


#39595: date_default_timezone_set in wp-settings.php is set prematurely and
ignorantly, regardless of other defined settings
-------------------------------+------------------------------
 Reporter:  mkormendy          |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Date/Time          |     Version:  4.7.1
 Severity:  minor              |  Resolution:
 Keywords:  reporter-feedback  |     Focuses:
-------------------------------+------------------------------

Comment (by romulodl):

 Replying to [comment:13 Otto42]:
 > @romulodl As a site administrator, you don't have to change it at all,
 ever. The PHP code is supposed to use UTC throughout. WordPress applies
 the timezone change according to the setting in the Settings->General
 page. That includes adjusting for daylight savings time, if you pick the
 correct timezone choice on that page.
 >
 > Basically, WordPress does the same job as PHP here, while leaving the
 default timezone as UTC for consistent time calculation throughout the
 rest of the system.

 @Otto42 Thanks for that. Just after my reply I saw that you can put
 `London` there, not just only `UTC+1`. Ane really really Sorry for the
 annoyance...

 Just for the sake of information. If you run `new DateTime` in your
 theme/plugin it will not get the timezone selected in wordpress settings.
 Always add manually the TimeZone object.

 The selected timezone will be available via
 `get_option('timezone_string')`

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39595#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list