How to get from the client’s time zone from his IP address

I want Time Time clients to move from their IP address for my web application. I tried using the getTimezone javascripts function, but some clients have their own timezone or time set incorrectly. I want to get the offset and return some information to the client based on their time zone.

Thanks for taking the time to read the question. I am also open to alternative approaches.

Regards, Vamyip

+4
source share
2 answers

If you can call the web service, you might like to try ipinfodb.com. For instance:

http://ipinfodb.com/ip_query.php?ip=69.59.196.211&timezone=true

returns:

<Response> <Ip>69.59.196.211</Ip> <Status>OK</Status> <CountryCode>US</CountryCode> <CountryName>United States</CountryName> <RegionCode>41</RegionCode> <RegionName>Oregon</RegionName> <City>Corvallis</City> <ZipPostalCode>97333</ZipPostalCode> <Latitude>44.4698</Latitude> <Longitude>-123.343</Longitude> <TimezoneName>America/Los_Angeles</TimezoneName> <Gmtoffset>-25200</Gmtoffset> <Isdst>1</Isdst> </Response> 

A faster option is to use the free MaxMind Geolite city . If this is not enough, you can probably upgrade to a more accurate paid version. I can’t talk about the quality of the paid version, since I never used it. You can download the blob binary version of the same database, and then use the C # class to request it.

+3
source

google 'geolocation ip'

There is an API that you can call provided by companies. Some of them are free, some are not.

-3
source

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


All Articles