9

I need an api like the Places Autocomplete but with the place timezone in the response. I could use the Places Autocomplete api, to get the place reference from the response, than the Place Details api to get the longitude and latitude and finally the Google Time Zone API to get the place timezone. Can I do this with a single HTTP call?

user2298916
  • 421
  • 1
  • 5
  • 6

1 Answers1

4

If you just need the current UTC offset so you can tell what time it is at that place, you will usually find it in the results from the Details API. From the documentation:

utc_offset contains the number of minutes this Place’s current timezone is offset from UTC. For example, for Places in Sydney, Australia during daylight saving time this would be 660 (+11 hours from UTC), and for Places in California outside of daylight saving time this would be -480 (-8 hours from UTC).

However, as some have commented, and as discussed here, the place details API does not always return the time zone offset.

If it is not returned, or when you need the full IANA/Olson time zone id for the location, you will need to call the Time Zone API as you described.

You may also be interested in one of the other methods to obtaining a time zone from a location, which are listed here.

Community
  • 1
  • 1
Matt Johnson-Pint
  • 230,703
  • 74
  • 448
  • 575