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:
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.
$ pip install requests
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 |
Field | Type | Requirement | Description |
---|---|---|---|
original_time | String | Optional | Original time before conversion |
converted_time | String | Optional | Time after conversion |
diff_hour | Number | Optional | Difference in hours |
diff_min | Number | Optional | 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 thte 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'
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,%20Pakista'
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.