How to Get the Time Zone from Latitude and Longitude
- API or service
- Timezone API
- Task
- Latitude and longitude → time zone and UTC offset
- Examples
- Difficulty
- Beginner
- Time
- 5 min
You have a latitude and longitude—for example, a delivery stop, a store, or a user's device location—and need the time zone there: its IANA name, the UTC offset, or the local time. The Geoapify Timezone API returns the time zone at the coordinates together with the exact offset at a given moment, so daylight saving time is already applied.
Request the current offset, the offset at a specific date and time, or the list of offset changes within a period.
If you also need the address, the Reverse Geocoding API returns a timezone object together with it: the IANA name plus the standard and daylight saving offsets and abbreviations, for example America/New_York with -05:00 (EST) and -04:00 (EDT). It does not say which of the two offsets applies at a given moment; use the Timezone API when you need the exact offset or local time.
Replace
YOUR_API_KEYwith your Geoapify API key. Latitude ranges from-90to90; longitude ranges from-180to180. Dates must be between 2025-01-01 and 2031-12-31 (UTC).
Get the time zone for coordinates
The following coordinates point to Times Square in New York City:
https://api.geoapify.com/v1/timezone?lat=40.758&lon=-73.9855&apiKey=YOUR_API_KEY
Without an at parameter, the API uses the time of the request. Read the IANA time zone name from timezones[0].name, the current offset from utc_offset or offset_seconds, and the local clock time from local_time.
Live response: requested on 2026-10-23, while New York was on daylight saving time.
{
"lat": 40.758,
"lon": -73.9855,
"at": "2026-10-23T11:35:30.456Z",
"tzdb_version": "2026e",
"timezones": [
{
"name": "America/New_York",
"type": "daylightSaving",
"utc_offset": "-04:00",
"offset_seconds": -14400,
"abbreviation": "EDT",
"local_time": "2026-10-23T07:35:30.456-04:00",
"next_transition": {
"at": "2026-11-01T06:00:00.000Z",
"before": {
"type": "daylightSaving",
"utc_offset": "-04:00",
"offset_seconds": -14400,
"abbreviation": "EDT"
},
"after": {
"type": "standard",
"utc_offset": "-05:00",
"offset_seconds": -18000,
"abbreviation": "EST"
},
"offset_change_seconds": -3600,
"kind": "daylight-end"
}
}
]
}
type is standard, daylightSaving, or other. next_transition describes the next known offset change; it is null when no change is known within the supported date range—for example, in Phoenix (America/Phoenix) or Kathmandu (Asia/Kathmandu), which do not observe daylight saving time. tzdb_version shows which edition of the IANA time zone database produced the answer.
timezones is an array: at a disputed boundary, more than one time zone can be returned. Over open ocean, the API returns a nautical zone such as Etc/GMT+3; note that its sign is inverted by convention, and the actual offset is -03:00.
Get the offset at a specific date and time
Add at to get the offset for a scheduled event, a past timestamp, or any instant other than now. The value is an RFC 3339 timestamp with Z or an explicit offset, such as 2027-01-15T14:00:00Z or 2027-01-15T09:00:00-05:00. A timestamp without an offset is rejected with HTTP 400.
https://api.geoapify.com/v1/timezone?lat=40.758&lon=-73.9855&at=2027-01-15T14:00:00Z&apiKey=YOUR_API_KEY
Reduced response: This live response keeps the offset fields. The next_transition object is omitted.
{
"lat": 40.758,
"lon": -73.9855,
"at": "2027-01-15T14:00:00.000Z",
"tzdb_version": "2026e",
"timezones": [
{
"name": "America/New_York",
"type": "standard",
"utc_offset": "-05:00",
"offset_seconds": -18000,
"abbreviation": "EST",
"local_time": "2027-01-15T09:00:00.000-05:00"
}
]
}
The same coordinates now return -05:00 (EST) instead of -04:00 (EDT), and local_time shows that 14:00 UTC is 9:00 in the morning in New York. Request the offset for the instant you need instead of reusing an offset you looked up on another date.
List daylight saving time changes for a period
Use /v1/timezone/transitions to list every offset change at the coordinates between from (inclusive) and to (exclusive). The interval can be up to 366 days long.
https://api.geoapify.com/v1/timezone/transitions?lat=40.758&lon=-73.9855&from=2027-01-01T00:00:00Z&to=2028-01-01T00:00:00Z&apiKey=YOUR_API_KEY
Live response:
{
"lat": 40.758,
"lon": -73.9855,
"from": "2027-01-01T00:00:00.000Z",
"to": "2028-01-01T00:00:00.000Z",
"tzdb_version": "2026e",
"timezones": [
{
"name": "America/New_York",
"transitions": [
{
"at": "2027-03-14T07:00:00.000Z",
"before": {
"type": "standard",
"utc_offset": "-05:00",
"offset_seconds": -18000,
"abbreviation": "EST"
},
"after": {
"type": "daylightSaving",
"utc_offset": "-04:00",
"offset_seconds": -14400,
"abbreviation": "EDT"
},
"offset_change_seconds": 3600,
"kind": "daylight-start"
},
{
"at": "2027-11-07T06:00:00.000Z",
"before": {
"type": "daylightSaving",
"utc_offset": "-04:00",
"offset_seconds": -14400,
"abbreviation": "EDT"
},
"after": {
"type": "standard",
"utc_offset": "-05:00",
"offset_seconds": -18000,
"abbreviation": "EST"
},
"offset_change_seconds": -3600,
"kind": "daylight-end"
}
]
}
]
}
Each transition's at is in UTC: 2027-03-14T07:00:00Z is 2:00 local time, when clocks move forward to 3:00. kind is daylight-start, daylight-end, offset-change, or designation-change, and offset_change_seconds is not always one hour—on Lord Howe Island (Australia/Lord_Howe), clocks change by 30 minutes. A place without changes in the period returns an empty transitions array.
Get the time zone with JavaScript
Use this approach in browser applications or Node.js 18 and later. The function accepts latitude, longitude, and an optional Date, uses the built-in fetch() API, and returns the first time zone in the response.
async function getTimezone(latitude, longitude, date) {
const params = new URLSearchParams({
lat: String(latitude),
lon: String(longitude),
apiKey: "YOUR_API_KEY"
});
if (date) {
params.set("at", date.toISOString());
}
const response = await fetch(
`https://api.geoapify.com/v1/timezone?${params}`
);
if (!response.ok) {
throw new Error(`Timezone lookup failed: ${response.status}`);
}
const data = await response.json();
return data.timezones[0] ?? null;
}
const timezone = await getTimezone(40.758, -73.9855);
console.log(timezone ? `${timezone.name} ${timezone.utc_offset}` : "No time zone found");
Date.prototype.toISOString() always returns a UTC timestamp ending in Z, which the at parameter accepts. To display times in that zone, pass timezone.name to Intl.DateTimeFormat as the timeZone option. In browser applications, restrict the API key to the application’s allowed origins.
Get the time zone with Python
Use this approach in backend services, automation scripts, or data-processing jobs. It uses Python’s standard-library urllib and json modules, so no third-party dependency is required.
import json
from urllib.parse import urlencode
from urllib.request import urlopen
params = urlencode({
"lat": 40.758,
"lon": -73.9855,
"at": "2027-01-15T14:00:00Z",
"apiKey": "YOUR_API_KEY",
})
url = f"https://api.geoapify.com/v1/timezone?{params}"
with urlopen(url) as response:
data = json.load(response)
timezone = data["timezones"][0] if data["timezones"] else None
print(f"{timezone['name']} {timezone['utc_offset']}" if timezone else "No time zone found")
Remove at to get the current offset. urlopen() raises an HTTPError for unsuccessful responses, including HTTP 400 for coordinates or dates outside the supported range. Catch it when the application needs retries or custom error reporting.