Setting time zone based on IP?


#1

Is it possible to set a person’s time zone based on their IP or some
other factor than specifying their time zone?


#2

Hi Ben,

Ben J. wrote:

Is it possible to set a person’s time zone based on their IP

Not with any degree of certainty. IP addresses are not ‘handed out’
based
on geographic location.

or some other factor than specifying their time zone?

The decision about the time zone a particular spot on the earth will use
is
a political one. There are states in the US, for example, that do not
use
Daylight Savings Time. So clocks within some states within the Central
Time
Zone will be set to CST while others will be set to CDT. It gets worse.

If you really want to know what time zone a visitor is in, you need to
ask.

hth,
Bill


#3

Bill is absolutely right.
You can guess the users location based on their IP but not precise
enough.
The only way that will be satisfactory is to ask the user for that
kind of information.

The alternative way will be to use a little javascript function that
will collect users UTC offset using getTimezoneOffset(). You can make
use of AJAX to update the UI and to collect this kind of info.

But the main thing is why do you need this kind of information?