# Establish a customer's timezone

Exists a typical means for an internet server to be able to establish a customer's timezone within a website?

Probably from an HTTP header or component of the user-agent string?

0
2019-05-06 23:27:32
Source Share

There are no HTTP headers that will certainly report the customers timezone until now although it has actually been recommended to include it in the HTTP requirements.

If it was me, I would possibly attempt to bring the timezone making use of clientside JavaScript and afterwards send it to the web server making use of Ajax or something.

0
2019-05-08 20:47:18
Source

JavaScript is the most convenient means to get the customer's neighborhood time. I would certainly recommend making use of an XMLHttpRequest to return the neighborhood time, and also if that falls short, drop back to the timezone identified based upon their IP address.

Regarding geolocation, I've made use of MaxMind GeoIP on numerous tasks and also it functions well, though I'm not exactly sure if they give timezone information. It's a solution you spend for and also they give month-to-month updates to your data source. They give wrappers in numerous internet languages.

0
2019-05-08 19:23:58
Source

The most preferred (= =typical?) means of establishing the moment area I've seen about is merely asking the customers themselves. If your internet site calls for registration, this can be conserved in the customers' account information. For anon customers, the days can be presented as UTC or GMT or some such.

I'm not attempting to be a clever aleck. It's simply that occasionally some troubles have better remedies beyond any kind of programming context.

0
2019-05-08 04:38:27
Source

The magic all appears to be in

visitortime.getTimezoneOffset()


That's trendy, I really did not find out about that. Does it operate in Internet Explorer, etc? From there you need to have the ability to make use of JavaScript to Ajax, set cookies, whatever. I 'd possibly go the cookie course myself.

You'll require to permit the customer to transform it though. We attempted to make use of geolocation (using maxmind ) to do this a while earlier, and also it was incorrect sensibly usually - adequate to make it unworthy doing, so we simply allow the customer set it in their account, and also show a notification to customers that have not set theirs yet.

0
2019-05-07 16:37:33
Source