[wp-hackers] peculiar problem on setting GMT

Otto otto at ottodestruct.com
Wed Apr 15 01:57:50 GMT 2009


On Tue, Apr 14, 2009 at 6:42 PM, Beau Lebens <beau at dentedreality.com.au> wrote:
> 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 behind
> the scenes, by converting from the display time zone to GMT before storing
> 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, you're
> not messing with the timestamps in the database or the chronology anyway.

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.

-Otto
Sent from Memphis, Tennessee, United States


More information about the wp-hackers mailing list