[wp-hackers] Storing absolute time stamps

Austin Matzko if.website at gmail.com
Mon Jun 25 14:24:54 GMT 2007

On 6/25/07, Omry Yadan <omry at yadan.net> wrote:
> I suggest that we store UTC timestamp everywhere, and convert them
> before they are displayed.

WordPress stores the date values for comments and posts as both local
time and GMT time.

In every case, all you have to do to display times as offset from GMT
instead of local time--which would seem to address the issue you
mention--is to filter whatever time or date function you're using in
your theme templates.

In some cases, such as for the get_comment_time and get_post_time
functions, it's even simpler: you can pass to a function an optional
argument that allows you to specify whether or not you want GMT time.
For example, get_post_time('U') returns the post's local time;
get_post_time('U', true) returns it as GMT.

More information about the wp-hackers mailing list