Timezone Lookup API - Get Timezone from IP and More

The Timezone Lookup API allows you to retrieve timezone from IP address, location address, coordinates, timezone name, IATA Codes, ICAO Codes or UN/LO CODE. This API delivers a wide range of date and time information, including the current time, date in multiple formats, week, month, year, and Unix timestamp.

Get the timezone information by following ways:

  1. From timezonename
  2. From address (preferably city and country)
  3. From location coordinates (latitude and longitude)
  4. From IP address
  5. From IATA code
  6. From ICAO code
  7. From UN/LO Code

IP to Timezone API

Use our IP to timezone API to get timezone from IPv4 or IPv6 address by passing the ip query parameter. The response will include both timezone and geolocation details. In this scenario, you can also specify an additional "lang" parameter to receive geolocation information in multiple languages.

10K Free Credits, No Credit Card Required

Features

Real-Time Data

Get up-to-the-second timezone offset between two locations. Users always receive the most current and accurate time details.

Diverse Input Options

Use timezone name, location address, or location coordinates, IATA, ICAO or UN/LO CODE to perform time conversion making the api suitable for a wide range of applications.

Documentation

API Endpoint

GET

https://api.apifreaks.com/v1.0/geolocation/timezone

Test
LANGUAGE
Python
PHP
Java
Node
Ruby

API Request

ParameterRequiredTypeDefaultDescription
ipNoStringrequest ipIPv4 or IPv6 address to extract timezone informatin using IP address
tzNoString-Extract timezone information using timezone name
locationNoString-Extract timezone information using location (preferably city and country)
latNoNumber-Latitude to extract timezone information using location coordinates
longNoNumber-Longitude to extract timezone information using location coordinates
langNoStringenResponse language of "geo" field in case of lookup through IP address / location address. Possible values are: (1) en (English) (2) de (German) (3) ru (Russian) (4) ja (Japanese) (5) fr (French) (6) cn (Chinese Simplifed) (7) es (Spanish) (8) cs (Czech) (9) it (Italian)
iata_codeNoString-The 3 letter IATA code to extract the comprehensive airport details along with the timezone information, in which that airport exists.
icao_codeNoString-The 4 letter ICAO code to extract the comprehensive airport details along with the timezone information, in which that airport exists.
lo_codeNoString-The 5 letter UN/LO CODE to extract the comprehensive lo code/city details along with the timezone information of the concerned city.

API Response

Below are the response fields when performing a lookup using geographical coordinates or a time-zone name:

FieldTypeRequirementDescription
timezoneStringMandatory
The name of the timezone, e.g., "America/New_York"
timezone_offsetNumberMandatory
The time difference in hours from UTC for the specified timezone without considering DST
timezone_offset_with_dstNumberMandatory
The time difference in hours from UTC for the specified timezone, including DST
dateStringMandatory
The current date in the specified timezone in YYYY-MM-DD format
date_timeStringMandatory
The current date and time in the specified timezone in ISO 8601 format
date_time_txtStringMandatory
The current date and time in a human-readable format, e.g., "Wednesday, July 26, 2024, 15:00:00"
date_time_wtiStringMandatory
The current date and time in the specified timezone in "Weekday, Time" format
date_time_ymdStringMandatory
The current date and time in "YYYY-MM-DD HH:MM:SS" format
date_time_unixFloatMandatory
The current date and time as a Unix timestamp (seconds since Jan 1, 1970)
time_24StringMandatory
The current time in 24-hour format, e.g., "15:00:00"
time_12StringMandatory
The current time in 12-hour format with AM/PM, e.g., "03:00:00 PM"
weekNumberMandatory
The current week number of the year in the specified timezone
monthNumberMandatory
The current month number in the specified timezone
yearNumberMandatory
The current year in the specified timezone
year_abbrStringMandatory
The abbreviated current year in the specified timezone, e.g., "24" for 2024
is_dstBooleanMandatory
Indicates whether Daylight Saving Time (DST) is currently in effect in the specified timezone
dst_savingsNumberMandatory
The amount of time (in hours) by which clocks are adjusted for DST
dst_existsBooleanMandatory
Indicates whether DST is observed in the specified timezone
dst_startStringMandatory
The start date of the DST period in the specified timezone
dst_endStringMandatory
The end date of the DST period in the specified timezone
dst_start.utc_timeStringOptional
The UTC time of the DST start date
dst_start.durationStringOptional
The duration of the DST start transition
dst_start.gapBooleanOptional
Indicates whether there is a time gap at the start of DST
dst_start.datetimeAfterStringOptional
The date and time after the start of DST
dst_start.datetimeBeforeStringOptional
The date and time before the start of DST
dst_start.overlapBooleanOptional
Indicates whether there is an overlap period at the start of DST
dst_end.utc_timeStringOptional
The UTC time of the DST end date
dst_end.durationStringOptional
The duration of the DST end transition
dst_end.gapBooleanOptional
Indicates whether there is a time gap at the end of DST
dst_end.datetimeAfterStringOptional
The date and time after the end of DST
dst_end.datetimeBeforeStringOptional
The date and time before the end of DST
dst_end.overlapBooleanOptional
Indicates whether there is an overlap period at the end of DST

The following fields will be appended to the above response based on the lookup performed using a location address:

FieldTypeRequirementDescription
geo.locationStringMandatory
The complete geographical location, including country, state, city, and locality
geo.countryStringMandatory
The country of the geographical location
geo.stateStringMandatory
The state of the geographical location
geo.cityStringMandatory
The city of the geographical location
geo.localityStringMandatory
The locality or neighborhood of the geographical location
geo.latitudeFloatMandatory
The latitude coordinate of the geographical location
geo.longitudeFloatMandatory
The longitude coordinate of the geographical location

The following fields will be appended to the above response based on the lookup performed using an IP address:

FieldTypeRequirementDescription
geo.country_code2StringMandatory
The 2-letter country code (ISO 3166-1 alpha-2)
geo.country_code3StringMandatory
The 3-letter country code (ISO 3166-1 alpha-3)
geo.country_nameStringMandatory
The common name of the country
geo.continent_codeStringMandatory
The two-letter code of the continent
geo.continent_nameStringMandatory
The full name of the continent
geo.country_name_officialStringMandatory
The official name of the country
geo.state_provStringMandatory
The state or province of the geographical location
geo.is_euBooleanMandatory
Is the country belong to European Union?
geo.state_codeStringMandatory
The code for the state or province
geo.districtStringMandatory
The district of the geographical location
geo.cityStringMandatory
The city of the geographical location
geo.zip_codeStringMandatory
The postal code of the geographical location
geo.latitudeStringMandatory
The latitude coordinate of the geographical location
geo.longitudeStringMandatory
The longitude coordinate of the geographical location

The following fields will be appended to the above response based on the lookup performed using an IATA Code:

FieldTypeRequirementDescription
airportDetails.typeStringMandatory
The type of airport (small, medium, large)
airportDetails.nameStringMandatory
The full name of the airport
airportDetails.longitudeStringMandatory
The longitude coordinate of the airport location
airportDetails.latitudeStringMandatory
The latitude coordinate of the airport location
airportDetails.elevation_ftNumberMandatory
The elevation of the airport in feet
airportDetails.continent_codeStringMandatory
The 2-letter continent code where the airport is located
airportDetails.country_codeStringMandatory
The 2-letter country code where the airport is located
airportDetails.state_codeStringMandatory
The state or province code where the airport is located
airportDetails.municipalityStringMandatory
The city or municipality where the airport is located
airportDetails.cityStringMandatory
The city or administrative region that the airport serves to.
airportDetails.iata_codeStringMandatory
The IATA (International Air Transport Association) code for the airport
airportDetails.icao_codeStringMandatory
The ICAO (International Civil Aviation Organization) code for the airport
airportDetails.faa_codeStringMandatory
The FAA (Federal Aviation Administration) code for the airport

The following fields will be appended to the above response based on the lookup performed using an ICAO Code:

FieldTypeRequirementDescription
airportDetails.typeStringMandatory
The type of airport (small, medium, large)
airportDetails.nameStringMandatory
The full name of the airport
airportDetails.longitudeStringMandatory
The longitude coordinate of the airport location
airportDetails.latitudeStringMandatory
The latitude coordinate of the airport location
airportDetails.elevation_ftNumberMandatory
The elevation of the airport in feet
airportDetails.continent_codeStringMandatory
The 2-letter continent code where the airport is located
airportDetails.country_codeStringMandatory
The 2-letter country code where the airport is located
airportDetails.state_codeStringMandatory
The state or province code where the airport is located
airportDetails.municipalityStringMandatory
The city or municipality where the airport is located
airportDetails.iata_codeStringMandatory
The IATA (International Air Transport Association) code for the airport
airportDetails.icao_codeStringMandatory
The ICAO (International Civil Aviation Organization) code for the airport
airportDetails.faa_codeStringMandatory
The FAA (Federal Aviation Administration) code for the airport

The following fields will be appended to the above response based on the lookup performed using a UN/LO CODE Code:

FieldTypeRequirementDescription
loCodeDetails.lo_codeStringMandatory
The UN/LO CODE code for the location
loCodeDetails.city_nameStringMandatory
The name of the city or location
loCodeDetails.longitudeStringMandatory
The longitude coordinate of the location
loCodeDetails.latitudeStringMandatory
The latitude coordinate of the location
loCodeDetails.state_codeStringMandatory
The state or province code of the location
loCodeDetails.country_codeStringMandatory
The 2-letter country code of the location
loCodeDetails.administrative_countryStringMandatory
The administrative country name of the location
loCodeDetails.location_typeStringMandatory
The type of the location (e.g., port, airport, rail terminal)

HTTP Error Codes

HTTP StatusReasons
400
(1) When provided Latitude and Longitude values are not valid (2) When provided timezone is not valid (3) When timezone detail couldn't be found for the provided IP address

How-To-Guides

Timezone Information for an Address

Pass the address using location query parameter to get the timezone information for an address.

curl --location --request GET ' https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&location=London,%20UK'
# Response { "geo": { "country": "United Kingdom", "state": "England", "city": "London", "latitude": 51.505182, "longitude": -0.0999387 }, "timezone": "Europe/London", "timezone_offset": 0, "date": "2020-12-21", "date_time": "2020-12-21 13:17:59", "date_time_txt": "Monday, December 21, 2020 13:17:59", "date_time_wti": "Mon, 21 Dec 2020 13:17:59 +0000", "date_time_ymd": "2020-12-21T13:17:59+0000", "date_time_unix": 1608556679.524, "time_24": "13:17:59", "time_12": "01:17:59 PM", "week": "52", "month": "12", "year": "2020", "year_abbr": "20", "is_dst": false, "dst_savings": 1 }

When getting timezone information using the location address, the response will also contain the geo field for location information.

Timezone Information for Location Coordinates

Pass the latitude and longitude of a location as query parameters lat and long to get the timezone information for provided coordinates.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&lat=-27.4748&long=153.017'
# Response { "timezone": "Australia/Brisbane", "timezone_offset": 10, "date": "2020-12-21", "date_time": "2020-12-21 23:49:16", "date_time_txt": "Monday, December 21, 2020 23:49:16", "date_time_wti": "Mon, 21 Dec 2020 23:49:16 +1000", "date_time_ymd": "2020-12-21T23:49:16+1000", "date_time_unix": 1608558556.584, "time_24": "23:49:16", "time_12": "11:49:16 PM", "week": "52", "month": "12", "year": "2020", "year_abbr": "20", "is_dst": false, "dst_savings": 0 }

IP to Timezone API

Get timezone from IPv4 or IPv6 address by passing the ip query parameter to the IP to timezone API. The response will include both timezone and geolocation details. If the ip is not provided, the API will default to using the request's IP address.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&ip=1.1.1.1'
# Response { "geo": { "ip": "1.1.1.1", "country_code2": "AU", "country_code3": "AUS", "country_name": "Australia", "state_prov": "Queensland", "district": "South Brisbane", "city": "Brisbane", "zipcode": "4101", "latitude": "-27.47561", "longitude": "153.01537" }, "timezone": "Australia/Brisbane", "timezone_offset": 10, "date": "2020-12-21", "date_time": "2020-12-21 23:49:42", "date_time_txt": "Monday, December 21, 2020 23:49:42", "date_time_wti": "Mon, 21 Dec 2020 23:49:42 +1000", "date_time_ymd": "2020-12-21T23:49:42+1000", "date_time_unix": 1608558582.413, "time_24": "23:49:42", "time_12": "11:49:42 PM", "week": "52", "month": "12", "year": "2020", "year_abbr": "20", "is_dst": false, "dst_savings": 0 }

When getting timezone information using the ip address, the response will also contain the geo field for geolocation information for the ip address location. To get the geolocation information in a specific language, provide the language code using the lang parameter. Default geolocation response is in English.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&ip=1.1.1.1&lang=es
The languages supported are:
  1. en (English)
  2. es(Spanish)
  3. de (German)
  4. fr (French)
  5. ja (Japanese)
  6. it (Italian)
  7. cs (Czech)
  8. ru (Russian)
  9. cn (Chinese Simplifed)

Timezone and Airport Details from IATA Code

Pass any 3 letter IATA code as a query paramter iata_code to get the comprehensive airport details along with the timezone information, in which that airport exists.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&iata_code=DXB'
# Response { "airportDetails": { "type": "large_airport", "name": "Dubai International Airport", "latitude": "25.25280", "longitude": "55.36440", "elevation_ft": 62, "continent_code": "AS", "country_code": "AE", "state_code": "AE-DU", "municipality": "Dubai", "iata_code": "DXB", "icao_code": "OMDB", "faa_code": "" }, "timezone": "Asia/Dubai", "timezone_offset": 4, "timezone_offset_with_dst": 4, "date": "2024-11-08", "date_time": "2024-11-08 12:37:20", "date_time_txt": "Friday, November 08, 2024 12:37:20", "date_time_wti": "Fri, 08 Nov 2024 12:37:20 +0400", "date_time_ymd": "2024-11-08T12:37:20+0400", "date_time_unix": 1731055040.671, "time_24": "12:37:20", "time_12": "12:37:20 PM", "week": 45, "month": 11, "year": 2024, "year_abbr": "24", "is_dst": false, "dst_savings": 0, "dst_exists": false, "dst_start": "", "dst_end": "" }

Timezone and Airport Details from ICAO Code

Pass the any 4 letter ICAO code as a query paramter icao_code to get the comprehensive airport details along with the timezone information, in which that airport exists.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&icao_code=KATL'
# Response { "airportDetails": { "type": "large_airport", "name": "Hartsfield Jackson Atlanta International Airport", "latitude": "33.63670", "longitude": "-84.42810", "elevation_ft": 1026, "continent_code": "NA", "country_code": "US", "state_code": "US-GA", "municipality": "Atlanta", "iata_code": "ATL", "icao_code": "KATL", "faa_code": "" }, "timezone": "America/New_York", "timezone_offset": -5, "timezone_offset_with_dst": -5, "date": "2024-11-08", "date_time": "2024-11-08 05:26:18", "date_time_txt": "Friday, November 08, 2024 05:26:18", "date_time_wti": "Fri, 08 Nov 2024 05:26:18 -0500", "date_time_ymd": "2024-11-08T05:26:18-0500", "date_time_unix": 1731061578.272, "time_24": "05:26:18", "time_12": "05:26:18 AM", "week": 45, "month": 11, "year": 2024, "year_abbr": "24", "is_dst": false, "dst_savings": 0, "dst_exists": true, "dst_start": { "utc_time": "2024-03-10 TIME 07", "duration": "+1H", "gap": true, "dateTimeAfter": "2024-03-10 TIME 03", "dateTimeBefore": "2024-03-10 TIME 02", "overlap": false }, "dst_end": { "utc_time": "2024-11-03 TIME 06", "duration": "-1H", "gap": false, "dateTimeAfter": "2024-11-03 TIME 01", "dateTimeBefore": "2024-11-03 TIME 02", "overlap": true } }

Timezone and City Details from UN/LO CODE

Pass any 5 letter UN/LO CODE as a query paramter lo_code to get the comprehensive lo code/city details along with the timezone information of the concerned city.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY&lo_code=DEBER
# Response { "loCodeDetails": { "locode": "DEBER", "city_name": "Berlin", "state_code": "BE", "country_code": "DE", "administrative_country": "", "location_type": "Port, Rail Terminal, Road Terminal, Airport, Postal Exchange", "latitude": "52.51667", "longitude": "13.38333" }, "timezone": "Europe/Berlin", "timezone_offset": 1, "timezone_offset_with_dst": 1, "date": "2024-11-08", "date_time": "2024-11-08 11:45:06", "date_time_txt": "Friday, November 08, 2024 11:45:06", "date_time_wti": "Fri, 08 Nov 2024 11:45:06 +0100", "date_time_ymd": "2024-11-08T11:45:06+0100", "date_time_unix": 1731062706.441, "time_24": "11:45:06", "time_12": "11:45:06 AM", "week": 45, "month": 11, "year": 2024, "year_abbr": "24", "is_dst": false, "dst_savings": 0, "dst_exists": true, "dst_start": { "utc_time": "2024-03-31 TIME 01", "duration": "+1H", "gap": true, "dateTimeAfter": "2024-03-31 TIME 03", "dateTimeBefore": "2024-03-31 TIME 02", "overlap": false }, "dst_end": { "utc_time": "2024-10-27 TIME 01", "duration": "-1H", "gap": false, "dateTimeAfter": "2024-10-27 TIME 02", "dateTimeBefore": "2024-10-27 TIME 03", "overlap": true } }

Timezone Information for Calling Machine IP

Call the API without passing any location, coordinates, or IP address. It will use the calling machine's IP address to return the ip timezone information.

curl 'https://api.apifreaks.com/v1.0/geolocation/timezone?apiKey=API-KEY'

Pricing

To use the TimeZone API, API credits are required. Charges apply only for successful queries, defined by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be refunded.

For each successful request, 1 credit will be charged for timezone lookup. Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, ensuring you stay informed about your remaining balance and can optimize your resource allocation effectively.

Price Estimation Calculator