Is there a way to find the time zone a user is in when all I have is their IP address? I’m looking for the time offset I need to apply to the server time in order to find the time for the user’s location.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You’ll need to attempt to determine the location (which is far from 100% accurate). See
this question about doing just that.
See this question about translating a zip code into time zone (though that, again, is not 100% fool proof).
The short version is: it’s complicated. You’ll have to use a third-party service that maintains a database of IP masks to locations, then use the location determined there to determine the time zone.
It’s far more reliable to have the client simply send the time zone (or UTC offset) when it connects.
If this is a web application, see one more question about using JavaScript to determine the client time zone.