Web service - the current time zone for the city?

Is there any kind of web service (or some other way) to pull out the current time zone settings for the (USA) city. For parts of the country that do not follow daylight saving time and mostly jump when everyone else is switching daylight saving time ... I do not want to create my own database of places that do not follow DST. Is there any way to get data on request?

I need this for the database server (and not for client workstations) - there the entities are stored in the database, which have City, State as properties. I need to know the current time zone for these objects at any given time.

+46
timezone web-services
Sep 11 '08 at 6:30
source share
10 answers

earthtools.org provides a free web service to get the time zone from the city:

http://www.earthtools.org/webservices.htm#timezone

You simply pass the long / lat values ​​as follows: (This is for New York)

http://www.earthtools.org/timezone-1.1/40.71417/-74.00639




EDIT:

It seems that the peanuts were closed. A good alternative (this was not in 2008 when the answer to this question was given) is the Google Time Zone API. To use it, you must first activate the time zone API in your account. It's free if you stay below these limits:

  • 2500 inquiries in 24 hours.
  • 5 queries per second.

Documentation is available at Google Developers.

+42
Sep 11 '08 at 6:43
source share

We ran into the same problem, and along with the great suggestions above, Google has two additional APIs: one for the Time Zone from the geocode (latitude / longitude) and the geocode API.

For example, to get the time zone and offset for San Francisco:

1) Convert a city to a geocoded location:

http://maps.googleapis.com/maps/api/geocode/json?address=San%20Francisco,+CA&sensor=false

The geocoded location is in the JSON return data:

"location": { "lat": 37.77492950, "lng": -122.41941550 } 

2) Convert a geocoded location to a local time zone and offset, if any:

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

Returns current timezone information:

 { "status": "OK", "dstOffset": 0.0, "rawOffset": -28800.0, "timeZoneId": "America/Los_Angeles", "timeZoneName": "Pacific Standard Time" } 

The time zones for a region can vary for various reasons. Therefore, it’s nice to find a reputable server solution, not a cache. For more information, see the article in the Wikipedia time zone .

+58
Feb 20 '13 at 19:33
source share

Geonames.org has a wonderful set of mundane data available through webservice or for download:

http://www.geonames.org/export/ws-overview.html

In particular,

http://www.geonames.org/export/web-services.html#timezone

.

+15
Sep 11 '08 at 7:14
source share

Earthtool time zone information is not updated ... for the instance, the current Sri Lanka offset is +5.5 of GMT, but EarthTools is displayed as +6, which was the old offset until 2005.

I suggest GeoNames.org .

+7
Nov 24 2018-11-11T00:
source share

WorldTimeServer.com has what appears to be a comprehensive time zone database that you can access in a variety of formats, including .NET for use on the Internet.

There is no connection, just had to investigate the same thing recently.

+5
Sep 11 '08 at 6:43
source share

Simple standalone library: APTimeZones

To find the time zone for a location that you can use, for example, the Google Maps API time zones API. Unfortunately, this requires that you request a remote service, and you fall within their limits.

There is an Alterplay rom library called APTimeZones (Git) that allows you to retrieve NSTimeZone from a given location without having to connect to a remote service. APTimeZones works by requesting a local list of time zones (included in the library).

+1
Jun 02 '14 at 12:23
source share

In case someone comes across this issue.

  • You can use the Google API to search for an address. This returns latitude / consistency. Given these values, you can find the nearest time zone using, for example, PHP.

  • Or you can use an API like timezoneapi.io (I'm behind it), which allows you to search for an address / city / country. It returns the address, time zone information, and current date / time for a given given time zone.

https://timezoneapi.io/developers/address

+1
Jan 05 '17 at 1:27
source share

I found a free downloadable database here: http://citytimezones.info/

[edit] ... but more accurate information (including sources) based on Olson DB can be found here: http://en.wikipedia.org/wiki/Tz_database

0
Dec 11 '12 at 23:41
source share

I know this has been answered, but I am posting this answer because people can still find it useful. The selected answer is not working successfully now.

Google has its own service, which is very reliable and easy to use and displays information in JSON format. It even allows you to specify the time, for example, get the time zone on 02/02/2013 in Malta.

https://developers.google.com/maps/documentation/timezone/

0
Apr 26 '13 at 16:30
source share
0
Sep 09 '13 at 13:03 on
source share



All Articles