How to Use Timezone Comparison API

A diagram illustrating the various components and workflow of a Timezone API.

The EasyAPI Compare Endpoint is a robust feature that allows you to effortlessly compare various location-based attributes such as IP addresses, physical addresses, and time zones. This functionality is especially useful in a multitude of business scenarios, from personalizing user experiences based on local time zones to implementing geo-based access controls for your digital resources.


Before you can access the Compare Endpoint, you’ll need to obtain an API key from EasyAPI. If you haven’t done this yet, you can find the steps to get your API key in the Getting Started Guide.

Step 1: Make an API Request

In Browser

You can make a simple API request by entering the following URL into your web browser:



In Python

You can use the Python requests  library to make an API call as follows:

					import requests

api_key = "YOUR_API_KEY"
url = "https://api.easyapi.io/v1.0/compare"

params = {
  "ip1": "",
  "timezone2": "Europe/Helsinki",
  "api_key": api_key

response = requests.get(url, params=params)
data = response.json()



In PHP, you can use the curl  extension to make the API request:

$api_key = "YOUR_API_KEY";
$url = "https://api.easyapi.io/v1.0/compare?ip1=$api_key";

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);
$data = json_decode($response, true);



Step 2: Analyze the Response

Response Body

Here’s a snippet of the response body you’d get:

            "date_time":"08/23/2023 21:56:35",
            "date_time_txt":"Wednesday, August 23, 2023 21:56:35",
            "date_time_wti":"Wed, 23 Aug 2023 21:56:35 +0200",
         "state":"Province of Verona",
            "location":"41.9, 12.483333333333333",
            "date_time":"08/23/2023 22:56:36",
            "date_time_txt":"Wednesday, August 23, 2023 22:56:36",
            "date_time_wti":"Wed, 23 Aug 2023 22:56:36 +0300",
            "location":"60.166666666666664, 24.966666666666665",

Fields Description

Field Name Description Example Value
class The class type of the response “compare”
properties.address1 First address for comparison (if applicable) null
properties.address2 Second address for comparison (if applicable) null
properties.compare.time_difference_hours Time difference between locations in hours 1
properties.compare.time_difference_minutes Time difference between locations in minutes 60
properties.compare.time_difference_seconds Time difference between locations in seconds 3600
properties.compare.distance_feet Distance between locations in feet 6164939
properties.compare.distance_km Distance between locations in kilometers 1879
properties.compare.distance_meters Distance between locations in meters 1879074
properties.compare.distance_miles Distance between locations in miles 1168
properties.compare.distance_nautical_miles Distance between locations in nautical miles 1015
properties.ip1.city City of the first IP address “Pescantina”
properties.ip1.country Country of the first IP address “Italy”
properties.ip1.country_code Country code of the first IP address “IT”
properties.ip1.datetime.date Date for the first IP address “08/23/2023”
properties.ip1.datetime.time Time for the first IP address “21:56:35”
properties.ip1.ip IP address of the first location “”
properties.ip1.location Geographical coordinates of the first IP address “45.4802,10.867”
properties.ip1.postal Postal code of the first IP address “37026”
properties.ip1.state State or province of the first IP address “Province of Verona”
properties.ip1.state_code State code of the first IP address “VR”
properties.ip1.timezone.capital Capital city of the timezone for the first IP “Rome”
properties.ip1.timezone.continent Continent of the timezone for the first IP “EU”
properties.ip1.timezone.currency_name Currency name used in the first IP’s country “Euro”
properties.ip1.timezone.languages Languages spoken in the first IP’s timezone “it-IT,de-IT,fr-IT,sc,ca,co,sl”
properties.ip1.timezone.phone_prefix Phone prefix for the first IP’s country “39”
properties.ip1.timezone.tld Top-level domain for the first IP’s country “.it”
properties.ip2 Information about the second IP address (if applicable) null
properties.timezone1 Timezone information for the first entity (if applicable) null
properties.timezone2.datetime.date The date for the second timezone “08/23/2023”
properties.timezone2.datetime.time The time for the second timezone “22:56:36”
properties.timezone2.timezone.capital Capital city of the second timezone “Helsinki”
properties.timezone2.timezone.continent Continent of the second timezone “EU”
properties.timezone2.timezone.currency_name Currency name used in the second timezone “Euro”
properties.timezone2.timezone.languages Languages spoken in the second timezone “fi-FI,sv-FI,smn”
properties.timezone2.timezone.phone_prefix Phone prefix for the second timezone’s country “358”
properties.timezone2.timezone.tld Top-level domain for the second timezone’s country “.fi”

Step 3: Implement in Your Application

Once you have the comparison data, you can integrate it into your application for various purposes:

  • Personalization: Customize your application’s UI based on the user’s local time.
  • Access Control: Restrict or grant access to resources based on geographic location.
  • Route planning: Create optimised routes, based on distances between locations


Congratulations! You have successfully implemented the Compare Endpoint into your application.

The Compare Endpoint is a versatile tool that enables a multitude of use-cases and functionalities, enriching both your data insights and user experience.

What's Next?

For more information and functionalities, explore the following:

Happy coding!

Choose the Plan That Fits Your Need

Easy, transparent, and budget-friendly!