[wp-trac] [WordPress Trac] #37440: current_time function outputs local time when it should output GMT time

WordPress Trac noreply at wordpress.org
Fri Jul 22 17:39:15 UTC 2016


#37440: current_time function outputs local time when it should output GMT time
--------------------------+------------------------------
 Reporter:  bynicolas     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Date/Time     |     Version:  4.5.3
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by bynicolas):

 Hi @SergeyBiryukov, you are right, I didn't see that setting for the UTC
 timezone.

 But wouldn't it be better to still use gmdate(). If for any reason the
 default timezone was changed by a user, then current_time( 'format', true)
 wouldn't return the GMT time (the expected value) since date() only
 formats a local time and would then be affected by
 date_default_timezone_set() change.

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


More information about the wp-trac mailing list