Stay organized with collections Save and categorize content based on your preferences.
Time ZoneTime Zone API requests are constructed as a URL string. The API returns time zone data for a point on the earth, specified by a latitude/longitude pair. Note that time zone data may not be available for locations over water, such as oceans or seas.
A Time Zone request takes the following form:
https://maps.googleapis.com/maps/api/timezone/outputFormat?parameters
where outputFormat
may be either of the following values:
json
(recommended), indicates output in JavaScript Object Notation (JSON); orxml
, indicates output in XML, wrapped within a <TimeZoneResponse>
node.Note: URLs must be properly encoded to be valid and are limited to 16384 characters for all web services. Be aware of this limit when constructing your URLs. Note that different browsers, proxies, and servers may have different URL character limits as well.
Required parametersA comma-separated latitude,longitude tuple, location=39.6034810,-119.6822510
, representing the location to look up.
The desired time as seconds since midnight, January 1, 1970 UTC. The Time Zone API uses the timestamp
to determine whether or not Daylight Savings should be applied, based on the time zone of the location
.
Note that the API does not take historical time zones into account. That is, if you specify a past timestamp, the API does not take into account the possibility that the location was previously in a different time zone.
The language in which to return results.
language
is not supplied, the API attempts to use the preferred language as specified in the Accept-Language
header.This section includes some sample queries that demonstrate features of the API.
The below query performs a time zone request for Nevada, USA. The timestamp is set to December 5, 2024.
URLhttps://maps.googleapis.com/maps/api/timezone/json ?location=39.6034810%2C-119.6822510 ×tamp=1733428634 &key=YOUR_API_KEYcURL
curl -L -X GET 'https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810%2C-119.6822510×tamp=1733428634&key=YOUR_API_KEY'JSON
{ "dstOffset": 0, "rawOffset": -28800, "status": "OK", "timeZoneId": "America/Los_Angeles", "timeZoneName": "Pacific Standard Time", }XML
<TimeZoneResponse> <status>OK</status> <raw_offset>-28800.0000000</raw_offset> <dst_offset>0.0000000</dst_offset> <time_zone_id>America/Los_Angeles</time_zone_id> <time_zone_name>Pacific Standard Time</time_zone_name> </TimeZoneResponse>
The below query performs a time zone request for Nevada, USA. The location is the same as the above request, but the timestamp is set to March 15th, 2024. The response now includes a Daylight Savings Time offset.
URLhttps://maps.googleapis.com/maps/api/timezone/json ?location=39.6034810%2C-119.6822510 ×tamp=1710547034 &key=YOUR_API_KEYcURL
curl -L -X GET 'https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810%2C-119.6822510×tamp=1710547034&key=YOUR_API_KEY'JSON
{ "dstOffset": 3600, "rawOffset": -28800, "status": "OK", "timeZoneId": "America/Los_Angeles", "timeZoneName": "Pacific Daylight Time", }XML
<TimeZoneResponse> <status>OK</status> <raw_offset>-28800.0000000</raw_offset> <dst_offset>3600.0000000</dst_offset> <time_zone_id>America/Los_Angeles</time_zone_id> <time_zone_name>Pacific Daylight Time</time_zone_name> </TimeZoneResponse>
This example is similar to the above two, but sets a language parameter. The response will now be localized to Spanish.
URLhttps://maps.googleapis.com/maps/api/timezone/json ?language=es &location=39.6034810%2C-119.6822510 ×tamp=1710547034 &key=YOUR_API_KEYcURL
curl -L -X GET 'https://maps.googleapis.com/maps/api/timezone/json?location=39.6034810%2C-119.6822510×tamp=1710547034&language=es&key=YOUR_API_KEY'JSON
{ "dstOffset": 3600, "rawOffset": -28800, "status": "OK", "timeZoneId": "America/Los_Angeles", "timeZoneName": "hora de verano del Pacífico", }XML
<TimeZoneResponse> <status>OK</status> <raw_offset>-28800.0000000</raw_offset> <dst_offset>3600.0000000</dst_offset> <time_zone_id>America/Los_Angeles</time_zone_id> <time_zone_name>hora de verano del Pacífico</time_zone_name> </TimeZoneResponse>Time Zone responses
For each valid request, the Time Zone returns a response in the format indicated within the request URL.
TimeZoneResponse Field Required Type Descriptionstatus
required TimeZoneStatus See TimeZoneStatus for more information. dstOffset
optional number
The offset for daylight-savings time in seconds. This will be zero if the time zone is not in Daylight Savings Time during the specified timestamp
.
errorMessage
optional string
Detailed information about the reasons behind the given status code. Included if status other than Ok
.
rawOffset
optional number
The offset from UTC (in seconds) for the given location. This does not take into effect daylight savings.
timeZoneId
optional string
a string containing the ID of the time zone, such as "America/Los_Angeles" or "Australia/Sydney". These IDs are defined by Unicode Common Locale Data Repository (CLDR) project, and currently available in file timezone.xml. When a timezone has several IDs, the canonical one is returned. In xml responses, this is the first alias of each timezone. For example, "Asia/Calcutta" is returned, not "Asia/Kolkata".
timeZoneName
optional string
The long form name of the time zone. This field will be localized if the language parameter is set. eg. Pacific Daylight Time
or Australian Eastern Daylight Time
.
The status
field within the Time Zone response object contains the status of the request. The status
field may contain the following values:
OK
indicates that the request was successful.
INVALID_REQUEST
indicates that the request was malformed.
OVER_DAILY_LIMIT
indicates any of the following:
OVER_QUERY_LIMIT
indicates the requestor has exceeded quota.
REQUEST_DENIED
indicates that the API did not complete the request. Confirm that the request was sent over HTTPS instead of HTTP.
UNKNOWN_ERROR
indicates an unknown error.
ZERO_RESULTS
indicates that no time zone data could be found for the specified position or time. Confirm that the request is for a location on land, and not over water.
The local time of a given location is the sum of the timestamp
parameter, and the dstOffset
and rawOffset
fields from the result.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["The Time Zone API provides time zone data for a given latitude/longitude and timestamp, including Daylight Savings Time information."],["Requests are constructed as URLs with required parameters for location and timestamp, and an optional language parameter for localization."],["Responses are provided in JSON or XML format, containing details like time zone ID, name, and UTC offsets."],["The API may return various status codes indicating the success or failure of the request, such as `OK`, `INVALID_REQUEST`, or `ZERO_RESULTS`."],["Local time can be calculated by adding the timestamp parameter to the `dstOffset` and `rawOffset` values from the API response."]]],["The Time Zone API returns data for a given latitude/longitude, using a URL string with parameters. Required parameters include `location` (latitude, longitude) and `timestamp` (seconds since January 1, 1970 UTC). An optional `language` parameter localizes the response. The API outputs in JSON or XML, with responses containing `status`, `dstOffset`, `rawOffset`, `timeZoneId`, and `timeZoneName`. Daylight Savings is factored in using the timestamp. It provides various status codes, and local time is calculated by adding the timestamp to the dstOffset and rawOffset.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4