[wp-hackers] peculiar problem on setting GMT

Silverstein, Jesse Jesse.Silverstein at xerox.com
Wed Apr 15 04:24:35 GMT 2009

It should also be possible to display both the time relative to the post
author and the time relative to the viewing user. It could be as simple
as "17:30 IST (08:00 EST)" where IST is the author's time zone and the
user is viewing from EST. Assuming the query is changed to sort based on
post_date_gmt (which is should be), the author's time should be stored
in post_date, and is easily display (already), then detect users TZ via
JS and calculate from GMT and display both. As one of the options from a
theming standpoint, this gives users both sets of information: "What
time did s/he post this?" & "What time was it here when this was

-Jesse Silverstein

-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Otto
Sent: Tuesday, April 14, 2009 9:58 PM
To: wp-hackers at lists.automattic.com
Subject: Re: [wp-hackers] peculiar problem on setting GMT

On Tue, Apr 14, 2009 at 6:42 PM, Beau Lebens <beau at dentedreality.com.au>
> If posts are stored with their GMT time (which they are), then they
> would be sorted according to that, which should keep them in the
> correct order all the time, since it's a "standardized scale".

On Tue, Apr 14, 2009 at 6:46 PM, Jennifer Hodgdon
<yahgrp at poplarware.com> wrote:
> Otto -- I think that WP stores all times for updates and such as GMT
> the scenes, by converting from the display time zone to GMT before
> the information.

WordPress stores both, actually. Local time in the post_date column
and GMT time in the post_date_gmt column.

However, the query system only uses the post_date, not the GMT version
of it. So yes, your ordering will be wrong with the current code.

On Tue, Apr 14, 2009 at 6:53 PM, SoJ Web <sojweb at indiana.edu> wrote:
> And if all you do is apply a filter to the time display functions,
> not messing with the timestamps in the database or the chronology

That is a valid point, however you're limiting your audience
unnecessarily here, I think. Why only allow registered users to see it
in their time zone? If you're going to display time in the viewer's
timezone, then it seems to me that a javascript approach to detect the
time zone and adjust accordingly makes more sense. Then it works for
everybody, without any server side code really necessary.

The only reason I can see to have users have their own time zone is to
adjust the times of their posts to their local time, instead of to the
blog's local time. And that's perfectly fine and dandy, just don't
forget the ordering issues you'll have. This should be a relatively
simple fix though, just fix the order bit in wp-includes/query.php to
use post_date_gmt instead of post_date.

Sent from Memphis, Tennessee, United States
wp-hackers mailing list
wp-hackers at lists.automattic.com

More information about the wp-hackers mailing list