Find time zone from IP address

Is there a way to find the time zone the user is in when all I have is their IP address? I am looking for a time offset that I need to apply to server time in order to find the time for the user's location.

+3
source share
5 answers

You will need to try to determine the location (which does not match 100%). See this question about it.

See this question about translating a zip code into a time zone (although this again is not 100% proof).

Short version: it is complicated. You will need to use a third-party service that maintains a database of IP masks at locations, and then specify the location that is defined for the time zone.

It is more reliable that the client simply sends the time zone (or UTC offset) when it is connected.

If this is a web application, see another question about using JavaScript to determine the client’s time zone.

+9
source

MaxMind offers a database that you can purchase that will help you with your task: http://www.maxmind.com/app/city

0
source
0

restSharp.org https://ipdata.co

var client = new RestClient("https://api.ipdata.co");
var request = new RestRequest("1.1.1.1", Method.GET);
request.AddHeader("Content-Type", "application/json");
IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string
RestResponse<Ip> response2 = client.Execute<Ip>(request);
var time_zone = response2.Data.time_zone;
0

, UTC Offset IP- ipapi.co:

https://ipapi.co/8.8.8.8/timezone
> America/Los_Angeles

https://ipapi.co/8.8.8.8/utc_offset
> -0800
0

Source: https://habr.com/ru/post/1746882/


All Articles