[development] Timezone Changes Depending on Page

matt at mattfarina.com matt at mattfarina.com
Wed Oct 8 15:40:19 UTC 2008


Not sure how your site is setup but, are people from around the world  
viewing your pages anonymously with their timezones being used and  
then the pages being cached?

Quoting Ken Rickard <agentrickard at gmail.com>:

> Try resetting the global timezone variable in hook_init().
>
> <code>
> 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;
> }
> </code>
>
> 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
> http://ken.therickards.com
>




More information about the development mailing list