Timezone API
The Timezone API provides timezone and time offset data for any latitude/longitude coordinates or city in the world.
/v1/timezone GET
https://api.api-ninjas.com/v1/timezone
Get timezone info by city/state/country or location coordinates (latitude/longitude). Returns the timezone name of the specified input location and the time offset in seconds.
Parameters
timezonerequiredTimezone name.
latrequired premiumLatitude of desired location.
lonrequired premiumLongitude of desired location.
cityrequired premiumCity name.
stateoptional premiumUS state (for United States cities only).
countryoptional premiumCountry name.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
The response will be a JSON object with the following fields:
timezoneTimezone name.
utc_offsetTime offset in seconds from GMT.
local_timeLocal time in the specified timezone.
cityCity name. Only available for lat/lon or city/state/country inputs.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/timezone?timezone=Europe/LondonHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
{
"timezone": "Europe/London",
"utc_offset": 0,
"local_time": "2025-03-05 05:50:32",
"city": "london"
}Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/timezone?city=London" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.