[wp-trac] [WordPress Trac] #25555: get_comment_time('c') and date_i18n('c') uses UTC timezone only

WordPress Trac noreply at wordpress.org
Thu Oct 10 12:35:02 UTC 2013


#25555: get_comment_time('c') and date_i18n('c') uses UTC timezone only
--------------------------+-----------------------------
 Reporter:  raubvogel     |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Date/Time     |    Version:  3.6.1
 Severity:  normal        |   Keywords:  needs-patch
--------------------------+-----------------------------
 Calling
 {{{
 get_comment_time('c')
 }}}
 (wordpress\wp-includes\comment-template.php:629) returns date and time
 like 2013-10-10T12:22:56+00:00. Date and time values are correct, i. e.,
 it considers the timezone set in Wordpress. But +00:00 is wrong! In my
 case it has to be +02:00 because I set the timezone to CEST (Berlin,
 GMT+2).

 I could trace the issue: get_comment_time('c') calls
 {{{
 date_i18n('c')
 }}}
 (wordpress\wp-includes\functions.php:84) which calls PHP’s date() by
 {{{
 $j = @$datefunc( $dateformatstring, $i );
 }}}
 (wordpress\wp-includes\functions.php:138) at the end (@$datefunc =
 date()). But date() depends on PHP’s date_default_timezone_set() which is
 set by wordpress/wp-settings.php:36 to
 {{{
 // WordPress calculates offsets from UTC.
 date_default_timezone_set( 'UTC' );
 }}}
 Therefore date() considers not the timezone set in Wordpress. Don’t know
 how to patch this. It’s possible that more code is affected than the shown
 one.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/25555>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list