[wp-trac] [WordPress Trac] #25331: date_i18n returns erroneous result

WordPress Trac noreply at wordpress.org
Mon Sep 16 19:56:56 UTC 2013


#25331: date_i18n returns erroneous result
---------------------------+----------------------
 Reporter:  DavidAnderson  |       Owner:
     Type:  defect (bug)   |      Status:  closed
 Priority:  normal         |   Milestone:
Component:  Date/Time      |     Version:  3.6.1
 Severity:  normal         |  Resolution:  invalid
 Keywords:                 |
---------------------------+----------------------
Changes (by johnbillion):

 * status:  new => closed
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Comment:

 You were right the first time around by using `get_date_from_gmt()`.  The
 `date_i18n()` function is used for formatting a date according to the
 current locale, not for converting a date to your blog's timezone.

 The incredibly convoluted code to output a GMT/UTC date in your blog's
 timezone and format it according to the current locale is:

 `echo date_i18n( 'Y-m-d G:i', get_date_from_gmt( date( 'Y-m-d H:i:s',
 $unixtime ), 'U' ) );`

 We definitely need a new function for this I think (in another ticket).

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25331#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list