Convert a provided timestamp from one timezone to another timezone by providing IP addresses, location addresses, coordinates, timezone names, and various codes, IATA Codes, ICAO Codes or UN/LO CODE.
There are six ways to consume the timezone converter API:
You can provide the time to convert using either format 'yyyy-MM-dd HH:mm' or 'yyyy-MM-dd HH:mm:ss'. If no time is provided, the api will convert the current time.
Get up-to-the-second timezone offset between two locations. Users always receive the most current and accurate time details.
Use timezone name, location address, or location coordinates to perform time conversion making the api suitable for a wide range of applications.
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
time | No | String | current_time | Time value for conversion. Two formats supported: 1. yyyy-MM-dd HH:mm 2. yyyy-MM-dd HH:mm:ss |
tz_from | No | String | - | From timezone name for conversion using timezone name |
tz_to | No | String | - | To timezone name for conversion using timezone name |
lat_from | No | Number | - | From latitude coordinate for conversion using location coordinates |
long_from | No | Number | - | From longitude coordinate for conversion using location coordinates |
lat_to | No | Number | - | To latitude coordinate for conversion using location coordinates |
long_to | No | Number | - | To longitude coordinate for conversion using location coordinates |
location_from | No | String | - | From location address for conversion using location address |
location_to | No | String | - | To location address for conversion using location address |
iata_from | No | String | - | From IATA airport code for conversion using airport code |
iata_to | No | String | - | To IATA airport code for conversion using airport code |
icao_from | No | String | - | From ICAO airport code for conversion using airport code |
icao_to | No | String | - | To ICAO airport code for conversion using airport code |
locode_from | No | String | - | From UN/LO CODE for conversion using location code |
locode_to | No | String | - | To UN/LO CODE for conversion using location code |
Field | Type | Requirement | Description |
---|---|---|---|
original_time | String | Mandatory | Original time before conversion |
converted_time | String | Mandatory | Time after conversion |
diff_hour | Number | Mandatory | Difference in hours |
diff_min | Number | Mandatory | Difference in minutes |
HTTP Status | Reasons |
---|---|
400 | When one of the tz_from or tz_to is not valid |
Pass the names of both timezones as tz_from and tz_to query parameters. tz_from is the timezone to convert and tz_to is the timezone to convert to.
# Response { "original_time": "2023-12-08 11:00", "converted_time": "2023-12-08 18:30", "diff_hour": 7.5, "diff_min": 450 }curl --location --request GET ' https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API-KEY&tz_from=America/Argentina/Catamarca&tz_to=Asia/Kabul&time=2023-12-08%2011:00'
Pass the latitudes and longitudes of both locations using the query params lat_from, long_from and lat_to, long_to.
# Response { "original_time": "2023-12-08 11:00", "converted_time": "2023-12-08 18:30", "diff_hour": 7.5, "diff_min": 450 }curl --location --request GET ' https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API-KEY&lat_from=34.0207305&long_from=-118.6919163&lat_to=53.4736827&long_to=-77.3977062&time=2023-12-08%2011:00'
Pass the address of both locations using the query params location_from and location_to.
# Response { "original_time": "2023-12-08 07:00", "converted_time": "2023-12-08 16:00", "diff_hour": 9, "diff_min": 540 }curl --location --request GET ' https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API-KEY&location_from=New%20York,%20USA&location_to=Lahore,%20Pakistan&time=2023-12-08%2007:00'
Pass the IATA codes of both airports using the query params iata_from and iata_to.
# Response { "original_time": "2025-01-21 13:42:52", "converted_time": "2025-01-21 09:42:52", "diff_hour": 4, "diff_min": 240 }curl 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API_KEY&iata_from=DXB&iata_to=LHR'
Pass the ICAO codes of both airports using the query params icao_from and icao_to.
# Response { "original_time": "2025-01-30 09:00", "converted_time": "2025-01-30 06:00:00", "diff_hour": 3, "diff_min": 180 }curl 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API_KEY&icao_from=YSSY&icao_to=ZBAA&time=2025-01-30%2009%3A00'
Pass the UN/LO CODE codes of both cities using the query params locode_from and locode_to.
# Response { "original_time": "2025-02-28 9:00:00", "converted_time": "2025-01-21 06:43:13", "diff_hour": 10, "diff_min": 600 }curl 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API_KEY&locode_from=PKISB&locode_to=USNYC&time=2025-02-28%209%3A00%3A00'
Omit the time query parameter and the api will perform conversion for the current time
# Response { "original_time": "2023-12-08 07:00", "converted_time": "2023-12-08 16:00", "diff_hour": 9, "diff_min": 540 }curl --location --request GET 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API-KEY&location_from=New%20York,%20USA&location_to=Lahore,%20Pakistan'
To use the TimeZone Converter 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 converter. 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.