[wp-trac] [WordPress Trac] #33624: date_i18n do not returns time in GMT even if GMT is set to false

WordPress Trac noreply at wordpress.org
Mon Mar 12 15:28:39 UTC 2018


#33624: date_i18n do not returns time in GMT even if GMT is set to false
--------------------------------------+------------------------------
 Reporter:  KestutisIT                |       Owner:
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  Awaiting Review
Component:  Date/Time                 |     Version:  4.3
 Severity:  normal                    |  Resolution:
 Keywords:  2nd-opinion dev-feedback  |     Focuses:  ui
--------------------------------------+------------------------------

Comment (by Rarst):

 The `$gmt` argument is essentially broken completely and `date_i18n()` is
 absolutely not designed to output anything other timezone from WP
 settings.

 If you need a localized output with custom time zone you would have to
 override timezone option on the fly, for example implementation see
 https://github.com/Rarst/wpdatetime/blob/master/php/WpDateTimeTrait.php#L88-L96

 And yes, it's incorrectly documented to accept Unix timestamp as well,
 while it actually expects "WordPress timestamp" with time zone offset
 added.

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


More information about the wp-trac mailing list