Timezone Converter - Time Offset Between Locations

Convert a provided timestamp from one time zone to another time zone by providing either timezone names, location coordinates or location addresses.

There are three ways to consume timezone converter API:

  1. Using timezone names
  2. Using location coordinates
  3. Using location addresses (preferably city and country)

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
$ pip install requests

API Request

ParameterRequiredTypeDefaultDescription
timeNoStringcurrent_time
Time 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

API Response

FieldTypeRequirementDescription
original_timeStringOptional
Original time before conversion
converted_timeStringOptional
Time after conversion
diff_hourNumberOptional
Difference in hours
diff_minNumberOptional
Difference in minutes

HTTP Error Codes

HTTP StatusReasons
400
When one of the tz_from or tz_to is not valid

How-To-Guides

Convert time using time zone names

Pass the names of both timezones as tz_from and tz_to query parameters. tz_from is thte timezone to convert and tz_to is the timezone to convert to.

$ 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'
# 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 coordinate

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

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

Convert current time

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

$ curl --location --request GET ' https://api.apifreaks.com/v1.0/geolocation/timezone-converter?apiKey=API-KEY&location_from=New%20York,%20USA&location_to=Lahore,%20Pakista'
# 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 time zone 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