[Zope3-Users] obtaining time zone from http request

Gary Poster gary at zope.com
Tue Aug 30 10:26:53 EDT 2005


On Aug 30, 2005, at 5:10 AM, Lennart Regebro wrote:

> Getting the timezone from request is probably impossible.

Correct.  You can't get *the* timezone.  You can get the possible  
timezones, on the basis of the Accept-Language header.

> However, you
> can do it with javascript:
>
>
> <script type="text/javascript" language="javascript">
> <!--
> var tzo=(new Date().gettimezoneOffset()/60)*(-1);
> // -->
> </script>
>
> or something like that. This could be hacked into the relevant
> webpages, but you still need a form... Maybe you can set it when you
> log in?

Yes, that's a reasonable solution for some apps, and generally a good  
approach to remember.  As you said, though, it's difficult to do it  
in a non-hacky, general way.  On the other hand, I might like to see  
if I can use the trick to have a timezone widget do a better job of  
finding an initial value.

Gary



More information about the Zope3-users mailing list