NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Timezone API

The Timezone API provides timezone and time offset data for any latitude/longitude coordinates or city in the world.

(4.5)

From 7,662 users

2,300+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
172ms221ms232ms450ms844ms

Didn't find what you were looking for? Suggest an improvement


/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

Note: at least one of the following must be provided: timezone, lat and lon, or city.

  • timezone  optional

    Timezone name.

  • lat  optional premium

    Latitude of desired location.

  • lon  optional premium

    Longitude of desired location.

  • city  optional premium

    City name.

  • state  optional premium

    US state (for United States cities only).

  • country  optional premium

    Country name.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • 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!

timezone

Try this endpoint live with a free API key

Instant access — no credit card required.

https://api.api-ninjas.com/v1/timezone?timezone=Europe%2FLondon

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
{
    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.

Frequently Asked Questions

  • Yes, but you must have a premium subscription. Commercial use of the Timezone API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.
  • The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.
  • Send a GET request to /v1/timezone with at least one of the following: a timezone name, a city (optionally narrowed with state for US cities and country), or a lat and lon coordinate pair. If you need to resolve a place name or coordinates first, pair it with the Geocoding API or City API.
  • Each response is a JSON object containing the timezone name, the utc_offset (the time offset in seconds from GMT), and the local_time in that timezone, plus a city field when you query by lat/lon or city/state/country. See the error codes page for responses to unsuccessful requests.
  • It is ideal for scheduling apps, displaying local times for users in different regions, and converting between zones for global teams. For just the current time in a named zone you can also use the World Time API, and browse other location data tools under our APIs.
  • The lat, lon, city, state, and country parameters are premium features, while lookups by timezone name are available on all plans. See our pricing page for details or register for a free key to get started.