[wp-trac] [WordPress Trac] #25365: timeAgo attribute for revisions produces the wrong result due to missing UTC in strtotime

WordPress Trac noreply at wordpress.org
Sun Jun 29 17:37:03 UTC 2014


#25365: timeAgo attribute for revisions produces the wrong result due to missing
UTC in strtotime
--------------------------+-----------------------
 Reporter:  biranit       |       Owner:
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:
Component:  Revisions     |     Version:  3.6.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+-----------------------

Comment (by adamsilverstein):

 Biranit - thanks for the feedback.

 In order to simplify timezone issues, WordPress always keeps track of time
 internally using UTC. Then, when the time is displayed it's converted the
 the local time that's defined in the Timezone setting on the General
 Settings page. The proper place to set your timezone within WordPress is
 under Settings->General (see http://cl.ly/image/3O3N170m2C3R).

 Can you try setting your timezone there and commenting out out or deleting
 the date_default_timezone_set call in your functions.php file? When I
 tested this locally, the revision time_ago called returned the proper
 value.

 The UTC/timezone issue has a long history that relates in part to legacy
 support of PHP4 - see Otto's comments here -
 http://wordpress.org/support/topic/why-does-wordpress-set-timezone-to-
 utc?replies=5#post-3749681

 There is a long term effort to improve timezone handling in WordPress - if
 you are interested in helping out with this effort, take a look at these
 related tickets: #28636, #25555, #20973, #23384

 Replying to [comment:8 Biranit]:
 > I think in my case, the issue is down to the fact that our theme's
 function file has the line:
 >
 > date_default_timezone_set('Asia/Jerusalem');
 >
 > For us, timezone functions are crucial. Everything on the server is set
 up for this timezone -- including php.ini, OS timezone + clock AND the
 hardware clock.
 >
 > Yet the revisions are all off, as they appear in UTC+0 instead of UTC+3
 (Asia/Jerusalem).
 >
 > Personally, I still think this is a bug - or just an oversight - that
 should be fixed...

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


More information about the wp-trac mailing list