Inferring timezone for HTTP headers

I am encountering the classic 'hosting timezone different from customer
timezone' problem. The hosting timezone is CST, but users all over the
world are visiting the site.

I understand I can make the Timezone selection a user preference and use
TZInfo (http://tzinfo.rubyforge.org/) to do the math.

But, is there anyway to infer the client timezone from the HTTP headers
or the request object?

Not in Firefox 2.0 on the mac at least... I don't think I've ever heard of this anywhere though... would be a nice feature though.

You could do this by getting the user's ip, doing a location lookup and
then matching the country/state with a timezone. It would be a bit
inaccurate (esp. since some cities run on timezones different to the
rest of the state/province).

But how to cache your pages if you have to compute the time/date for
every user?
I dunno anything about your website, but relative time (10 minutes ago,
1 hour ago..) ala gmail might be an option to solve the cache/user pref
pb. You just have to time-out the cache every ten minutes or so and
compute the elapsed time is very easy in rails.Yet if your app is an
agenda like application, just forget everything I said.

Philip Hallstrom wrote:

I am encountering the classic 'hosting timezone different from customer
timezone' problem. The hosting timezone is CST, but users all over the
world are visiting the site.

I understand I can make the Timezone selection a user preference and use
TZInfo (http://tzinfo.rubyforge.org/) to do the math.

But, is there anyway to infer the client timezone from the HTTP headers
or the request object?

Not in Firefox 2.0 on the mac at least... I don't think I've ever heard
of this anywhere though... would be a nice feature though.

Thanks for your reply Philip.

Yes, it would be a great feature. Perhaps, we should place a request to
firefox-dev to add this in their future releases. Once firefox does this
everyone else will follow - just like all the other nice features in
firefox.

Anyone know whats the best channel to do that?

Probably won't happen... even if Firefox did it, that's what only 20% of the users... until IE does it, it's not reliable... and even then isn't reliable until everyone upgrades...

Oh well :confused: