[wp-hackers] Storing absolute time stamps

Mark Jaquith mark.wordpress at txfx.net
Mon Jun 25 16:14:59 GMT 2007


On Jun 25, 2007, at 8:55 AM, Omry Yadan wrote:

> I just saw that my server time zone is off by one hour, probably  
> because of DST.
>
> so I changed the offset value in the admin page, refreshed the post  
> page and nothing changed.
>
> I am guessing that the reason for that is that the absolute time is  
> calculated when the comment is submitted, and stored as such.
>
> I suggest that we store UTC timestamp everywhere, and convert them  
> before they are displayed.

Calculating the offset on the fly would allow offset changes to  
invalidate the dates of previous comments and posts.  Even worse, it  
would break the permalinks of some posts.  Say you posted something  
at 0205 GMT with -03 offset.  So 11:05pm "yesterday."  If you change  
the offset to -02, now the post is at 12:05am "today"  Now the  
permalink URL changes.

We store the GMT date and the local date, which is calculated as GMT  
+ offset at the time the post was published.  This is the same as us  
storing GMT + offset per post.  Either way it is two fields, and this  
way involves less processing.

--
Mark Jaquith
http://markjaquith.com/

Covered Web Services
http://coveredwebservices.com/

WordPress Ninja @ b5media Inc
http://b5media.com/




More information about the wp-hackers mailing list