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
- timezonerequired- Timezone name. 
- latrequired premium- Latitude of desired location. 
- lonrequired premium- Longitude of desired location. 
- cityrequired premium- City name. 
- stateoptional premium- US state (for United States cities only). 
- countryoptional premium- Country name. 
Headers
- X-Api-Keyrequired- API Key associated with your account. 
Response
The response will be a JSON object with the following fields:
- timezone- Timezone name. 
- utc_offset- Time offset in seconds from GMT. 
- local_time- Local time in the specified timezone. 
- city- City 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.