The Time Zone API is a service that accepts an HTTP request of latitude/longitude coordinates and a desired date and time. It returns the time zone data for the location, including offsets for UTC and daylight savings time.
Why use the Time Zone API
With the Time Zone API, you can develop applications that provide the time zone ID and name for dates and times at specific locations on a map. For example, you can show the following time zone data:
- Localized time zone names for map locations from the Google Maps Platform.
- Time zone offsets from UTC and for daylight savings.
Time zone data can be particularly useful when you want to have your website or app display time-based data relevant to your users.
What you can do with the Time Zone API
With the Time Zone API, you can request the time zone for locations on the surface of the earth, with the time offset from UTC and for daylight savings time for each of those locations.
How the Time Zone API works
The Time Zone API accepts an HTTPS request of latitude/longitude coordinates, the desired date and time as a timestamp, and optionally, a language code. It returns data in the format specified by the request. The following example shows a request for Nevada, USA, with a requested output in JSON.
https://maps.googleapis.com/maps/api/timezone/json ?location=39.6034810%2C-119.6822510 ×tamp=1331161200 &key=YOUR_API_KEY
Resources
The following table summarizes the resources available through the Time Zone API along with the data it returns.
Data resources | Data returned | Return format |
---|---|---|
Timezone
You provide your request along with location and timestamp. See required parameters. |
|
|
How to use the Time Zone API
1 | Get set up | Start with Set up your Google Cloud project and complete the setup instructions that follow. |
2 | Try a timezone request | Once you have an API key, you can start testing out the Time Zone API directly from your browser. See Time Zone examples in the Timezone requests and responses guide for details. |
3 | Understand response basics | Explore how to use timezone data in your app or website. See Time Zone responses for details. |
5 | Incorporate timezone data into your own app! | You can use timezone data to enhance apps and websites for users across different time-based locales. |
Available client libraries
Call this API in the language of your choice through one of the following client libraries:
- Java Client for Google Maps Services
- Python Client for Google Maps Services
- Go Client for Google Maps Services
- Node.js Client for Google Maps Services
The Java Client, Python Client, Go Client and Node.js Client for Google Maps Services are community-supported client libraries, open sourced under the Apache 2.0 License. Download them from GitHub, where you can also find installation instructions and sample code.
What's next
- Learn how to make Time Zone requests: Go to Time Zone Requests and responses.
- Follow best practices: Go to Web Services Best Practices.