API Directory › 🌍 Geo & Location › TimezoneDB
API KeyHTTPSCORS

TimezoneDB API

Time zone and local time data for any location or coordinates.

Auth
API Key
HTTPS
Yes
CORS
Yes
Open TimezoneDB docs ↗

What it does

TimeZoneDB returns the current time, UTC offset, DST status and abbreviation for a location — looked up by IANA zone name, by coordinates, or by IP — plus a list of all zones and conversion between two zones.

Base URL

http://api.timezonedb.com/v2.1

Authentication

Register for a free API key and pass it as ?key=YOUR_KEY with &format=json. The free tier is HTTP only; HTTPS needs a paid key.

Code examples

curl (by position)
curl -s "http://api.timezonedb.com/v2.1/get-time-zone?key=$TZDB_KEY&format=json&by=position&lat=48.8566&lng=2.3522"
Python (by zone)
import requests

r = requests.get("http://api.timezonedb.com/v2.1/get-time-zone",
    params={"key": KEY, "format": "json", "by": "zone",
            "zone": "Asia/Tokyo"}, timeout=10)
d = r.json()
print(d["zoneName"], d["gmtOffset"], d["formatted"])

Rate limits & quotas

Free tier: 1 request per second (a hard limit — faster returns RATE_LIMIT). No monthly cap is published but sustained abuse is blocked. The response status field is OK or FAILED with a message.

Key response fields

zoneNameIANA zone, e.g. Europe/Paris
gmtOffsetCurrent offset from UTC in seconds
dst"1" if daylight saving is currently active
formattedCurrent local date-time as a string
abbreviatione.g. CET / CEST

Common errors

status FAILED, INVALID_KEYKey missing or wrong.
status FAILED, INVALID_ZONEUnknown zone name — check against /list-time-zone.
RATE_LIMITMore than 1 request/second on the free tier.
(no HTTPS)Free endpoint is HTTP only.

When to use it (and alternatives)

Handy when you have coordinates or an IP and need the correct local time and DST handling without shipping a timezone database. Note ipgeolocation.io and OpenCage already include timezone data in their responses, which can save you a call.

FAQ

How do I get the timezone for a lat/lon?

Use by=position with lat and lng. The API maps the point to its IANA zone and returns the current offset and DST state.

Why am I limited to one request per second?

That is the free-tier cap. Cache results by zone (offsets only change at DST boundaries) and you will rarely need to call it often.

Does it handle historical or future times?

The get-time-zone endpoint accepts a time parameter (Unix timestamp) so you can ask for the offset/DST state at a specific moment, and list-time-zone plus convert-time-zone cover conversions.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

IP LookupDNS Lookup

Related Geo & Location APIs

← Back

More Geo & Location APIs · All 196 APIs