> Documentation index: https://developers.google.com/maps/documentation/llms.txt

The Time Zone API is an HTTPS web service that accepts latitude/longitude coordinates and a timestamp and returns the time zone ID, time zone name (optionally localized), offset from UTC, and daylight saving offset for that location, in JSON or XML.

## Time Zone API: key facts

- **Product:** Time Zone API
- **Category:** Places
- **Platform:** Web service (REST)
- **Runs on:** Server (backend code)
- **Launch stage:** GA
- **Lifecycle:** Active
- **Overview:** [Time Zone API overview](https://developers.google.com/maps/documentation/timezone/overview.md.txt)

## Time Zone API: when to use it

**Use Time Zone API when:**

- You need the time zone ID (for example, `America/Los_Angeles`) for a latitude/longitude pair.
- You need the UTC offset and daylight saving offset for a location at a specific timestamp.
- You need to calculate the local time at a location from a UTC timestamp.
- You need localized time zone names for map locations by passing a `language` parameter.

## Time Zone API: setup

- **Service to enable:** `timezone-backend.googleapis.com`
- **Authentication:** API key
- **Get started:** [Set up Time Zone API](https://developers.google.com/maps/documentation/timezone/get-started.md.txt)
- **Reference:** [Time Zone API reference](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt)
- **Pricing:** [Time Zone API usage and billing](https://developers.google.com/maps/documentation/timezone/usage-and-billing.md.txt)
- **Policies:** [Time Zone API policies](https://developers.google.com/maps/documentation/timezone/policies.md.txt)

## Time Zone API: common mistakes

- **Problem:** For a past `timestamp`, the API uses the location's current `timeZoneId`. It doesn't account for the location having been in a different time zone, so results for places whose zone boundaries changed can be wrong, and no error is returned. **Fix:** Don't rely on the API for historical time zone boundary changes; handle historical cases separately. See [/maps/documentation/timezone/requests-timezone](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt).
- **Problem:** Requests for locations over water (oceans or seas) can return `ZERO_RESULTS` because time zone data may not be available there. **Fix:** Send coordinates on land and handle the `ZERO_RESULTS` status. See [/maps/documentation/timezone/requests-timezone](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt).
- **Problem:** Computing local time from `rawOffset` alone gives wrong results during daylight saving time, because `rawOffset` excludes DST. **Fix:** Calculate local time as `timestamp + dstOffset + rawOffset`. See [/maps/documentation/timezone/requests-timezone](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt).
- **Problem:** When a time zone has several IDs, the canonical CLDR ID is returned (for example, `Asia/Calcutta`, not `Asia/Kolkata`), which can break exact string matches against IANA names. **Fix:** Map aliases when comparing `timeZoneId` values with other time zone ID lists. See [/maps/documentation/timezone/requests-timezone](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt).
- **Problem:** Sending the API key in the `X-Goog-Api-Key` header instead of the `key` query parameter returns `REQUEST_DENIED` ("You must use an API key to authenticate each request to Google Maps Platform APIs..."). **Fix:** Pass the API key as the `key` URL query parameter. See [/maps/documentation/timezone/requests-timezone](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt).

## What you can do with Time Zone API

See the guides linked below for each task, or compare across products in the
[Capabilities Explorer](https://developers.google.com/maps/documentation/capabilities-explorer.md.txt).

- [Return the time zone for a timestamp and set of latitude/longitude coordinates.](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt)
- [Return daylight savings offset information for a time zone.](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt)
- [Specify the language for time zone requests.](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt)
- [Return the Unicode Common Locale Data Repository (CLDR) ID for a time zone.](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt)
- [Return the offset from UTC (in seconds) for a time zone.](https://developers.google.com/maps/documentation/timezone/requests-timezone.md.txt)