Time Zone Display

I need to get the time zone for a given address / location. Suppose that the address / location can be inverted by geocoding (using google) in lat / lng, if necessary.

This means that I may not have a zip code.

I really hoped that Google provided some kind of API for this, but it seems they do not. At a minimum, you can search Google for time “Washington time, DC” and get the time / TZ - but then I have to screen the scratches, which is not fun :(

I know that there are databases available that display locations in time zones, but this needs to be maintained. Has anyone come up with a complicated solution to this problem?

Thank!

+3
source share
4 answers

http://www.geonames.org/ provides an API that returns the time zone given lat / lng

+2
source

Google provides an API for this.

https://maps.googleapis.com/maps/api/timezone/<json or xml>?location=<lat>,<lng>×tamp=<unix timestamp>&sensor=<true or false>

eg:

https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810,-119.6822510×tamp=1331161200&sensor=false

+4
source

. ? ? : -, , , ( , ). GMT , , , , GMT. , "" , .

0
source

I wrote a small Java class for this, with a data structure built into the code. If you want to avoid using a web service, and the accuracy of 22 km is good enough, and you are happy to think that the time zone does not change, then this can help.

https://sites.google.com/a/edval.biz/www/mapping-lat-lng-s-to-timezones

0
source

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


All Articles