API Freaks logoAPI Freaks logo
CTRL+K

    APIs

  • Pricing
  • Resources
  • Tools

  • Contact us
CTRL+K
Sign InGet Started For Free
  • Overview
  • Documentation
  • How to Guides
  • Pricing
  • APIFreaks
  • Organization and Teams
  • Credits Usage API
  • IP Geolocation Lookup
  • Bulk IP Geolocation Lookup
  • Domain WHOIS Lookup
  • IP WHOIS Lookup
  • ASN Lookup
  • Domain WHOIS Historical Lookup
  • Domain WHOIS Reverse Lookup
  • Bulk Domain WHOIS Lookup
  • DNS Lookup
  • Historical DNS Lookup
  • Reverse DNS Lookup
  • Bulk DNS Lookup
  • SSL Certificate Lookup
  • Domain Availability
  • Bulk Domain Availability API
  • Website Screenshot
  • Bulk Screenshot
  • Currencies Exchange Rates
  • Currency Converter
  • Currency Time Series
  • Currency Fluctuation
  • Geolocalized Currency Converter
  • Live Commodity Prices
  • Commodity Historical Prices
  • Commodity Fluctuation
  • Commodity Time Series
  • Timezone Lookup
  • Timezone Converter
  • Zipcode Lookup
  • User Agent Parser
  • Bulk User Agent Parser
  • Astronomy API

Timezone Converter - Time Offset Between Locations

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:

  1. Using timezone names
  2. Using location coordinates
  3. Using location addresses (preferably city and country)
  4. Using IATA Codes
  5. Using ICAO Codes
  6. Using UN/LO CODE

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.

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 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/converter

Test
LANGUAGE
Python
PHP
Java
Node
Ruby
JavaScript
C#
$ pip install requests

API Request

ParameterRequiredTypeDefaultDescription
timeNoStringcurrent_timeTime value for conversion. Two formats supported: 1. yyyy-MM-dd HH:mm 2. yyyy-MM-dd HH:mm:ss
tz_fromNoString-From timezone name for conversion using timezone name
tz_toNoString-To timezone name for conversion using timezone name
lat_fromNoNumber-From latitude coordinate for conversion using location coordinates
long_fromNoNumber-From longitude coordinate for conversion using location coordinates
lat_toNoNumber-To latitude coordinate for conversion using location coordinates
long_toNoNumber-To longitude coordinate for conversion using location coordinates
location_fromNoString-From location address for conversion using location address
location_toNoString-To location address for conversion using location address
iata_fromNoString-From IATA airport code for conversion using airport code
iata_toNoString-To IATA airport code for conversion using airport code
icao_fromNoString-From ICAO airport code for conversion using airport code
icao_toNoString-To ICAO airport code for conversion using airport code
locode_fromNoString-From UN/LO CODE for conversion using location code
locode_toNoString-To UN/LO CODE for conversion using location code

API Response

For a comprehensive view of the API response structure and detailed field descriptions, explore the interactive Response Table by clicking here.

HTTP Error Codes

HTTP StatusReasons
400
(1) When one of the tz_from or tz_to is not valid. (2) When one of the location_from or location_to is not valid. (3) When one of the lat_from/long_from or lat_to/long_to is not valid. (4) When one of the icao_from or icao_to is not valid. (5) When one of the iata_from or iata_to is not valid. (6) When one of the unlo_from or unlo_to is not valid.

How-To-Guides

Convert time using timezone names

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.

curl -X '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'
# Response { "original_time": "2023-12-08 11:00", "converted_time": "2023-12-08 18:30:00", "diff_hour": 7.5, "diff_min": 450 }

Convert time using location coordinate

Pass the latitudes and longitudes of both locations using the query params lat_from, long_from and lat_to, long_to.

curl -X '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'
# Response { "original_time": "2023-12-08 11:00", "converted_time": "2023-12-08 18:30", "diff_hour": 7.5, "diff_min": 450 }

Convert time using location address

Pass the address of both locations using the query params location_from and location_to.

curl -X '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'
# Response { "original_time": "2023-12-08 07:00", "converted_time": "2023-12-08 16:00", "diff_hour": 9, "diff_min": 540 }

Convert Time using IATA Codes

Pass the IATA codes of both airports using the query params iata_from and iata_to.

curl -X 'GET' 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API_KEY&iata_from=DXB&iata_to=LHR'
# Response { "original_time": "2025-01-21 13:42:52", "converted_time": "2025-01-21 09:42:52", "diff_hour": 4, "diff_min": 240 }

Convert Time using ICAO Codes

Pass the ICAO codes of both airports using the query params icao_from and icao_to.

curl -X 'GET' 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API_KEY&icao_from=YSSY&icao_to=ZBAA&time=2025-01-30%2009%3A00'
# Response { "original_time": "2025-01-30 09:00", "converted_time": "2025-01-30 06:00:00", "diff_hour": 3, "diff_min": 180 }

Convert Time using UN/LO CODE

Pass the UN/LO CODE codes of both cities using the query params locode_from and locode_to.

curl -X 'GET' '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'
# Response { "original_time": "2025-02-28 9:00:00", "converted_time": "2025-01-21 06:43:13", "diff_hour": 10, "diff_min": 600 }

Convert current time

Omit the time query parameter and the api will perform conversion for the current time

curl -X 'GET' 'https://api.apifreaks.com/v1.0/geolocation/timezone/converter?apiKey=API-KEY&location_from=New%20York,%20USA&location_to=Lahore,%20Pakistan'
# Response { "original_time": "2023-12-08 07:00", "converted_time": "2023-12-08 16:00", "diff_hour": 9, "diff_min": 540 }

Pricing

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.

Price Estimation Calculator

Ready to get started?

Sign Up for Free

APIFreaks

API Catalog

  • Geolocation APIs
  • WHOIS APIs
  • DNS APIs
  • SSL APIs
  • Domain APIs
  • Screenshot APIs
  • Currency APIs
  • Commodity APIs
  • Timezone APIs
  • Zipcode APIs
  • User Agent APIs
  • Other APIs

Tools Catalog

  • Code Formatters
  • Data & Query Tools
  • Text Tools
  • Email Utilities
  • Viewers

Docs

  • APIs
  • Swagger Docs

Pricing & Accounts

  • Pricing
  • Sign up
  • Sign In

Company

  • About Us
  • Resources
  • Terms
  • Privacy

Copyright © 2024

Made in Pakistan