[wp-hackers] Timezones, server settings, and WP dates

Eric A. Meyer eric at meyerweb.com
Thu Jan 27 16:11:20 GMT 2005


Hello again,

    I was looking for a way last night to set WP so it spit out dates 
based on my time zone, and couldn't find one.  Here's the problem: 
the server meyerweb.com is running on is set to UTC, even though the 
server's nowhere near Greenwich.  That's understandable, but it means 
that if I do something like this:

    <?php the_time('l, j F Y :: Hi T'); ?>

...then when I post at 7:13:21pm Eastern Standard Time, the post will 
be marked as 'Thursday, 27 January 2005 :: 1913 UTC'.  Which is 
wrong, because that was five hours before I posted.
    Worse still, the RSS feed will say the following:

    <pubDate>Wed, 26 Jan 2005 19:13:21 +0000</pubDate>

...even though I posted from -0500.  This will mess up the sorting in 
aggregators, among other problems.
    Even more fun, I'm in location that observes Daylight Savings Time 
("summer time"), so depending on the time of year my UTC offset will 
be either -0500 or -0400.
    Basically, I want my displayed times and feed times to reflect my 
local TUC offset correctly.  I don't want to have to adjust the 
offset every time Daylight Savings comes and goes.  So basically, I 
want to have WP be aware of the time zone I'm in, instead of the time 
zone set for the server.  How can I do this, or is it not really 
possible short of altering WP (either via plugin or direct hacking)?
    An extra bonus would be the easy ability to just tell WP what time 
zone I'm posting from-- this will become important later this year 
when I'm in Japan for WWW2005-- and have it handle that 
automatically.  But absent that, I'll take the ability to be set to 
one specific time zone, and not have to worry about it again.

-- 
Eric A. Meyer  (eric at meyerweb.com)
Principal, Complex Spiral Consulting   http://complexspiral.com/
"CSS: The Definitive Guide," "CSS2.0 Programmer's Reference,"
"Eric Meyer on CSS," and more    http://meyerweb.com/eric/books/


More information about the hackers mailing list