[development] Timezone Changes Depending on Page

Ken Rickard agentrickard at gmail.com
Wed Oct 8 14:40:09 UTC 2008

Try resetting the global timezone variable in hook_init().

mymodule_init() {
// figure out the page request and set a $zone var to the offset accordingly.

$zone = -14400;  // the timezone offset in seconds (EDT here)
global $conf;
$conf['date_default_timezone'] = $zone;

This should temporarily override the site's timezone setting.

On Tue, Oct 7, 2008 at 7:24 PM, Kyle Cunningham <kyle at codeincarnate.com> wrote:
> Hi Everyone,
> I'm having an interesting problem on which the timezone of my site
> (Drupal 6.4) will change depending on the page being viewed.  This has
> led to very strange results (such as story postings dates being off) and
> there doesn't seem to be much rhyme or reason to which pages work (have
> the correct timezone) and which don't.
> I have the date.timezone variable set in the php.ini, but this doesn't
> seem to be effective.  The only thing I can think of is that there is
> possibly a problem with date.module, but things are working correctly on
> a different server.  Has anyone else experienced this or have any idea
> how to fix this?
> Best,
> Kyle Cunningham

Ken Rickard
agentrickard at gmail.com

More information about the development mailing list