Timezone API and IP to Timezone Lookup

IPGeolocation's free Timezone API and Time conversion API provides date and time related information such as current time, date in various formats, week, month, year, time in unix timestamp, UTC/GMT offset and day light saving time from timezone name, any IPv4 or IPv6 address or geolocation coordinates in JSON and XML format over secure HTTPS connection. The API also calculates precise time differences in hours and minutes between two locations using timezone, coordinates, or city.

    • stringip:"216.73.216.116" ,
    • objectlocation:Object,
      • stringcontinent_code:"NA" ,
      • stringcontinent_name:"North America" ,
      • stringcountry_code2:"US" ,
      • stringcountry_code3:"USA" ,
      • stringcountry_name:"United States" ,
      • stringcountry_name_official:"United States of America" ,
      • booleanis_eu:false ,
      • stringstate_prov:"Ohio" ,
      • stringstate_code:"US-OH" ,
      • stringdistrict:"Franklin" ,
      • stringcity:"Columbus" ,
      • stringzipcode:"43215" ,
      • stringlatitude:"39.96199" ,
      • stringlongitude:"-83.00275" ,
    • objecttime_zone:Object,
      • stringname:"America/New_York" ,
      • numberoffset:-5 ,
      • numberoffset_with_dst:-4 ,
      • stringdate:"2025-08-31" ,
      • stringdate_time:"2025-08-31 06:47:33" ,
      • stringdate_time_txt:"Sunday, August 31, 2025 06:47:33" ,
      • stringdate_time_wti:"Sun, 31 Aug 2025 06:47:33 -0400" ,
      • stringdate_time_ymd:"2025-08-31T06:47:33-0400" ,
      • numberdate_time_unix:1756637253.391 ,
      • stringtime_24:"06:47:33" ,
      • stringtime_12:"06:47:33 AM" ,
      • numberweek:35 ,
      • numbermonth:8 ,
      • numberyear:2025 ,
      • stringyear_abbr:"25" ,
      • stringcurrent_tz_abbreviation:"EDT" ,
      • stringcurrent_tz_full_name:"Eastern Daylight Time" ,
      • stringstandard_tz_abbreviation:"EST" ,
      • stringstandard_tz_full_name:"Eastern Standard Time" ,
      • booleanis_dst:true ,
      • numberdst_savings:1 ,
      • booleandst_exists:true ,
      • stringdst_tz_abbreviation:"EDT" ,
      • stringdst_tz_full_name:"Eastern Daylight Time" ,
      • objectdst_start:Object,
        • stringutc_time:"2025-03-09 TIME 07" ,
        • stringduration:"+1H" ,
        • booleangap:true ,
        • stringdate_time_after:"2025-03-09 TIME 03" ,
        • stringdate_time_before:"2025-03-09 TIME 02" ,
        • booleanoverlap:false ,
      • objectdst_end:Object,
        • stringutc_time:"2025-11-02 TIME 06" ,
        • stringduration:"-1H" ,
        • booleangap:false ,
        • stringdate_time_after:"2025-11-02 TIME 01" ,
        • stringdate_time_before:"2025-11-02 TIME 02" ,
        • booleanoverlap:true ,
  • Detailed Timezone Data

    Detailed timezone data consists of comprehensive information about the current time and date, presented in multiple formats. It also covers timezone offset values, daylight saving details like start and end times, any gaps or overlaps, and whether DST is active. Optionally, this data can be enriched with geolocation information when IP-based timezone detection is requested.

    Response
    1{
    2  "time_zone": {
    3    "name": "America/Los_Angeles",
    4    "offset": -8,
    5    "offset_with_dst": -7,
    6    "date": "2025-04-24",
    7    "date_time": "2025-04-24 09:27:07",
    8    "date_time_txt": "Thursday, April 24, 2025 09:27:07",
    9    "date_time_wti": "Thu, 24 Apr 2025 09:27:07 -0700",
    10    "date_time_ymd": "2025-04-24T09:27:07-0700",
    11    "date_time_unix": 1745512027.639,
    12    "time_24": "09:27:07",
    13    "time_12": "09:27:07 AM",
    14    "week": 17,
    15    "month": 4,
    16    "year": 2025,
    17    "year_abbr": "25",
    18    "is_dst": true,
    19    "dst_savings": 1,
    20    "dst_exists": true,
    21    "dst_start": {
    22      "utc_time": "2025-03-09 TIME 10",
    23      "duration": "+1H",
    24      "gap": true,
    25      "date_time_after": "2025-03-09 TIME 03",
    26      "date_time_before": "2025-03-09 TIME 02",
    27      "overlap": false
    28    },
    29    "dst_end": {
    30      "utc_time": "2025-11-02 TIME 09",
    31      "duration": "-1H",
    32      "gap": false,
    33      "date_time_after": "2025-11-02 TIME 01",
    34      "date_time_before": "2025-11-02 TIME 02",
    35      "overlap": true
    36    }
    37  }
    38}

    Geo Location Module

    When Time Zone API is called without any parameter, with the IP address or with the location address, it returns geolocation information for the concerned location, along with the Time Zone Data.

    Response
    1"location": {
    2  "continent_code": "NA",
    3  "continent_name": "North America",
    4  "country_code2": "US",
    5  "country_code3": "USA",
    6  "country_name": "United States",
    7  "country_name_official": "United States of America",
    8  "is_eu": false,
    9  "state_prov": "California",
    10  "state_code": "US-CA",
    11  "district": "Santa Clara",
    12  "city": "Mountain View",
    13  "zipcode": "94043-1351",
    14  "latitude": "37.42240",
    15  "longitude": "-122.08421"
    16}

    Get Airport details from IATA or ICAO codes

    The Time Zone API can retrieve detailed airport information along with time zone data using IATA or ICAO codes. The response includes the airport type, name, geo coordinates, elevation, continent, country and state codes, city, and IATA, ICAO, and FAA codes (if available), providing a complete profile of the airport's location and time zone.

    Response
    1"airport_details": {
    2  "type": "large_airport",
    3  "name": "London Heathrow Airport",
    4  "latitude": "51.47060",
    5  "longitude": "-0.46194",
    6  "elevation_ft": 83,
    7  "continent_code": "EU",
    8  "country_code": "GB",
    9  "state_code": "GB-ENG",
    10  "city": "London",
    11  "iata_code": "LHR",
    12  "icao_code": "EGLL",
    13  "faa_code": ""
    14}

    Get City Level Information from LO Code

    Our Time Zone API can be queried with an LO Code to provide city-level information, including the LO Code, location type, and geographic coordinates, along with relevant time zone data.

    Response
    1"lo_code_details": {
    2  "locode": "USNYC",
    3  "city": "New York",
    4  "state_code": "NY",
    5  "country_code": "US",
    6  "country_name": "",
    7  "location_type": "Port, Rail Terminal, Road Terminal, Airport, Postal Exchange",
    8  "latitude": "40.70000",
    9  "longitude": "-74.00000"
    10}

    Convert Time / Calculate Time Difference

    Our Time Zone API sub-feature can calculate the time difference between two locations based on their time zone names, geo coordinates, or city address locations.

    Response
    1{
    2  "original_time": "2024-03-11 14:47:32",
    3  "converted_time": "2024-03-11 02:47:32",
    4  "diff_hour": 12,
    5  "diff_min": 720
    6}

    Response in Multiple Languages

    You can retrieve the geolocation information for an IP address in the following languages:

    English FlagEnglish German FlagGerman Russian FlagRussian Japanese FlagJapanese French FlagFrench Chinese Simplified FlagChinese Simplified Spanish FlagSpanish Czech Republic FlagCzech Republic Italian FlagItalian Korean FlagKorean Persian FlagPersian Portuguese FlagPortuguese Standard Arabic FlagStandard Arabic

    Use Cases

    New Timezone During Traveling

    Build an application for Travellers who move a lot between different timezones! Use the timezone API to keep them up-to-date and up-to-time always, no matter how many time zones they skip over.

    timezone

    Ecommerce

    Make sure you know which part of the world your buyers are coming from and show them the right message at their right time.

    ecommerce

    Global Communication

    For teams that work from all over the globe, make communications a piece of cake using our free time zone API.

    communication

    Flight Management

    Airline platforms can build systems that facilitate users to show the accurate flight departure and arrival time in the passengers' time zones, helping them avoid any confusion and better plan their travel.

    flight-management

    Ready to get started?Get Started with Our Timezone API Today

    Enrich every request with precise geolocation and real-time threat intelligence, delivered on a global edge with a 99.99% uptime SLA. Start free and scale when you’re ready.

    CTA Illustration
    CTA Illustration
    Documentation

    Date, Time and Time Zone API

    Time zone API provides current time, date, and time zone related information. It can be consumed with the following input variations:

    • For a Time Zone Name
    • For any Address (preferrably, city address)
    • For Location Coordinates (latitude & longitude)
    • For any IP address
    • For any IATA code
    • For any ICAO code
    • For any UN/LO Code

    In each variation of the time zone API, time zone response remains same. Alongside this geolocation information is provided for IP address and location address search, airport details are provided for IATA code and ICAO code search, and city details are provided for UN/LO code search. Here are the details to consume each variation of the time zone API.

    Note

    For client-side calls to the endpoints mentioned below using the Request Origin (available on paid plans only), the apiKey parameter can be omitted.

    Time Zone Information from a Time Zone Name

    You can pass a valid time zone name as a query parameter tz to get the time zone information. Here is an example to get 'America/Los_Angeles' timezone information:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&tz=America/Los_Angeles'
    Response
    1{
    2  "time_zone": {
    3    "name": "America/Los_Angeles",
    4    "offset": -8,
    5    "offset_with_dst": -7,
    6    "date": "2025-04-24",
    7    "date_time": "2025-04-24 11:30:12",
    8    "date_time_txt": "Thursday, April 24, 2025 11:30:12",
    9    "date_time_wti": "Thu, 24 Apr 2025 11:30:12 -0700",
    10    "date_time_ymd": "2025-04-24T11:30:12-0700",
    11    "date_time_unix": 1745519412.353,
    12    "time_24": "11:30:12",
    13    "time_12": "11:30:12 AM",
    14    "week": 17,
    15    "month": 4,
    16    "year": 2025,
    17    "year_abbr": "25",
    18    "is_dst": true,
    19    "dst_savings": 1,
    20    "dst_exists": true,
    21    "dst_start": {
    22      "utc_time": "2025-03-09 TIME 10",
    23      "duration": "+1H",
    24      "gap": true,
    25      "date_time_after": "2025-03-09 TIME 03",
    26      "date_time_before": "2025-03-09 TIME 02",
    27      "overlap": false
    28    },
    29    "dst_end": {
    30      "utc_time": "2025-11-02 TIME 09",
    31      "duration": "-1H",
    32      "gap": false,
    33      "date_time_after": "2025-11-02 TIME 01",
    34      "date_time_before": "2025-11-02 TIME 02",
    35      "overlap": true
    36    }
    37  }
    38}

    Time Zone Information from any Address

    You can pass any address of a location as the query parameter location to get the time zone information. Here is an example to get the time zone information for the address 'London, UK':

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&location=London,%20UK'
    Response
    1{
    2  "location": {
    3    "location_string": "London, UK",
    4    "country_name": "United Kingdom",
    5    "state_prov": "England",
    6    "city": "London",
    7    "locality": "",
    8    "latitude": "51.50002",
    9    "longitude": "-0.19244"
    10  },
    11  "time_zone": {
    12    "name": "Europe/London",
    13    "offset": 0,
    14    "offset_with_dst": 1,
    15    "date": "2025-04-24",
    16    "date_time": "2025-04-24 19:31:42",
    17    "date_time_txt": "Thursday, April 24, 2025 19:31:42",
    18    "date_time_wti": "Thu, 24 Apr 2025 19:31:42 +0100",
    19    "date_time_ymd": "2025-04-24T19:31:42+0100",
    20    "date_time_unix": 1745519502.723,
    21    "time_24": "19:31:42",
    22    "time_12": "07:31:42 PM",
    23    "week": 17,
    24    "month": 4,
    25    "year": 2025,
    26    "year_abbr": "25",
    27    "is_dst": true,
    28    "dst_savings": 1,
    29    "dst_exists": true,
    30    "dst_start": {
    31      "utc_time": "2025-03-30 TIME 01",
    32      "duration": "+1H",
    33      "gap": true,
    34      "date_time_after": "2025-03-30 TIME 02",
    35      "date_time_before": "2025-03-30 TIME 01",
    36      "overlap": false
    37    },
    38    "dst_end": {
    39      "utc_time": "2025-10-26 TIME 01",
    40      "duration": "-1H",
    41      "gap": false,
    42      "date_time_after": "2025-10-26 TIME 01",
    43      "date_time_before": "2025-10-26 TIME 02",
    44      "overlap": true
    45    }
    46  }
    47}

    Time Zone Information from Location Coordinates

    You can pass the latitude and longitude of a location as query parameters lat and long to get the time zone information. Here is an example to get time zone information for '-27.4748, 153.017' coordinates:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&lat=-27.4748&long=153.017'
    Response
    1{
    2  "time_zone": {
    3    "name": "Australia/Brisbane",
    4    "offset": 10,
    5    "offset_with_dst": 10,
    6    "date": "2025-04-25",
    7    "date_time": "2025-04-25 04:33:10",
    8    "date_time_txt": "Friday, April 25, 2025 04:33:10",
    9    "date_time_wti": "Fri, 25 Apr 2025 04:33:10 +1000",
    10    "date_time_ymd": "2025-04-25T04:33:10+1000",
    11    "date_time_unix": 1745519590.635,
    12    "time_24": "04:33:10",
    13    "time_12": "04:33:10 AM",
    14    "week": 17,
    15    "month": 4,
    16    "year": 2025,
    17    "year_abbr": "25",
    18    "is_dst": false,
    19    "dst_savings": 0,
    20    "dst_exists": false,
    21    "dst_start": {},
    22    "dst_end": {}
    23  }
    24}

    IP to Time Zone

    You can pass any IPv4 or IPv6 address as a query parameter ip to get the regional timezone information. Here is an example to get the time zone information for the IP address '1.1.1.1':

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&ip=1.1.1.1'
    Response
    1{
    2  "ip": "1.1.1.1",
    3  "location": {
    4    "continent_code": "OC",
    5    "continent_name": "Oceania",
    6    "country_code2": "AU",
    7    "country_code3": "AUS",
    8    "country_name": "Australia",
    9    "country_name_official": "Commonwealth of Australia",
    10    "is_eu": false,
    11    "state_prov": "Queensland",
    12    "state_code": "AU-QLD",
    13    "district": "Brisbane",
    14    "city": "South Brisbane",
    15    "zipcode": "4101",
    16    "latitude": "-27.47306",
    17    "longitude": "153.01421"
    18  },
    19  "time_zone": {
    20    "name": "Australia/Brisbane",
    21    "offset": 10,
    22    "offset_with_dst": 10,
    23    "date": "2025-04-25",
    24    "date_time": "2025-04-25 05:19:02",
    25    "date_time_txt": "Friday, April 25, 2025 05:19:02",
    26    "date_time_wti": "Fri, 25 Apr 2025 05:19:02 +1000",
    27    "date_time_ymd": "2025-04-25T05:19:02+1000",
    28    "date_time_unix": 1745522342.084,
    29    "time_24": "05:19:02",
    30    "time_12": "05:19:02 AM",
    31    "week": 17,
    32    "month": 4,
    33    "year": 2025,
    34    "year_abbr": "25",
    35    "is_dst": false,
    36    "dst_savings": 0,
    37    "dst_exists": false,
    38    "dst_start": {},
    39    "dst_end": {}
    40  }
    41}
    Note
    When you get the time zone information through an IP address, API will also return the location field along with the time zone information.

    Using Client or Machine IP Address

    You can call the time zone API without passing any time zone, coordinates, IATA, ICAO, LO code or IP address as well. It will use the calling machine's IP address to return the regional time zone information. Here is an example:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY'
    Note

    This variation is widely used on embedded hardware and IoT devices to get current time after reboot.

    Time Zone and Airport Details from IATA Code

    We can pass any 3 letter IATA code as a query parameter iata_code to get the comprehensive airport details along with the time zone information, in which that airport exists. Here is an example to get the airport details about the IATA code 'DXB':

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&iata_code=DXB'
    Response
    1{
    2  "airport_details": {
    3    "type": "large_airport",
    4    "name": "Dubai International Airport",
    5    "latitude": "25.25280",
    6    "longitude": "55.36440",
    7    "elevation_ft": 62,
    8    "continent_code": "AS",
    9    "country_code": "AE",
    10    "state_code": "AE-DU",
    11    "city": "Dubai",
    12    "iata_code": "DXB",
    13    "icao_code": "OMDB",
    14    "faa_code": ""
    15  },
    16  "time_zone": {
    17    "name": "Asia/Dubai",
    18    "offset": 4,
    19    "offset_with_dst": 4,
    20    "date": "2025-04-24",
    21    "date_time": "2025-04-24 23:22:09",
    22    "date_time_txt": "Thursday, April 24, 2025 23:22:09",
    23    "date_time_wti": "Thu, 24 Apr 2025 23:22:09 +0400",
    24    "date_time_ymd": "2025-04-24T23:22:09+0400",
    25    "date_time_unix": 1745522529.622,
    26    "time_24": "23:22:09",
    27    "time_12": "11:22:09 PM",
    28    "week": 17,
    29    "month": 4,
    30    "year": 2025,
    31    "year_abbr": "25",
    32    "is_dst": false,
    33    "dst_savings": 0,
    34    "dst_exists": false,
    35    "dst_start": {},
    36    "dst_end": {}
    37  }
    38}

    Time Zone and Airport Details from ICAO Code

    We can pass any 4 letter ICAO code as a query parameter icao_code to get the comprehensive airport details along with the time zone information, in which that airport exists. Here is an example to get the airport details about the ICAO code 'KATL':

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&icao_code=KATL'
    Response
    1{
    2  "airport_details": {
    3    "type": "large_airport",
    4    "name": "Hartsfield Jackson Atlanta International Airport",
    5    "latitude": "33.63670",
    6    "longitude": "-84.42810",
    7    "elevation_ft": 1026,
    8    "continent_code": "NA",
    9    "country_code": "US",
    10    "state_code": "US-GA",
    11    "city": "Atlanta",
    12    "iata_code": "ATL",
    13    "icao_code": "KATL",
    14    "faa_code": ""
    15  },
    16  "time_zone": {
    17    "name": "America/New_York",
    18    "offset": -5,
    19    "offset_with_dst": -4,
    20    "date": "2025-04-24",
    21    "date_time": "2025-04-24 15:23:06",
    22    "date_time_txt": "Thursday, April 24, 2025 15:23:06",
    23    "date_time_wti": "Thu, 24 Apr 2025 15:23:06 -0400",
    24    "date_time_ymd": "2025-04-24T15:23:06-0400",
    25    "date_time_unix": 1745522586.935,
    26    "time_24": "15:23:06",
    27    "time_12": "03:23:06 PM",
    28    "week": 17,
    29    "month": 4,
    30    "year": 2025,
    31    "year_abbr": "25",
    32    "is_dst": true,
    33    "dst_savings": 1,
    34    "dst_exists": true,
    35    "dst_start": {
    36      "utc_time": "2025-03-09 TIME 07",
    37      "duration": "+1H",
    38      "gap": true,
    39      "date_time_after": "2025-03-09 TIME 03",
    40      "date_time_before": "2025-03-09 TIME 02",
    41      "overlap": false
    42    },
    43    "dst_end": {
    44      "utc_time": "2025-11-02 TIME 06",
    45      "duration": "-1H",
    46      "gap": false,
    47      "date_time_after": "2025-11-02 TIME 01",
    48      "date_time_before": "2025-11-02 TIME 02",
    49      "overlap": true
    50    }
    51  }
    52}

    Time Zone and City Details from UN/LOCODE

    We can pass any 5 letter UNLOCODE as a query parameter lo_code to get the comprehensive lo code/city details along with the time zone information of the concerned city. Here is an example to get the Germany city 'Berlin' details using the UNLOCODE code 'DEBER':

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&lo_code=DEBER'
    Response
    1{
    2  "lo_code_details": {
    3    "lo_code": "DEBER",
    4    "city": "Berlin",
    5    "state_code": "BE",
    6    "country_code": "DE",
    7    "country_name": "",
    8    "location_type": "Port, Rail Terminal, Road Terminal, Airport, Postal Exchange",
    9    "latitude": "52.51667",
    10    "longitude": "13.38333"
    11  },
    12  "time_zone": {
    13    "name": "Europe/Berlin",
    14    "offset": 1,
    15    "offset_with_dst": 2,
    16    "date": "2025-04-24",
    17    "date_time": "2025-04-24 21:23:59",
    18    "date_time_txt": "Thursday, April 24, 2025 21:23:59",
    19    "date_time_wti": "Thu, 24 Apr 2025 21:23:59 +0200",
    20    "date_time_ymd": "2025-04-24T21:23:59+0200",
    21    "date_time_unix": 1745522639.769,
    22    "time_24": "21:23:59",
    23    "time_12": "09:23:59 PM",
    24    "week": 17,
    25    "month": 4,
    26    "year": 2025,
    27    "year_abbr": "25",
    28    "is_dst": true,
    29    "dst_savings": 1,
    30    "dst_exists": true,
    31    "dst_start": {
    32      "utc_time": "2025-03-30 TIME 01",
    33      "duration": "+1H",
    34      "gap": true,
    35      "date_time_after": "2025-03-30 TIME 03",
    36      "date_time_before": "2025-03-30 TIME 02",
    37      "overlap": false
    38    },
    39    "dst_end": {
    40      "utc_time": "2025-10-26 TIME 01",
    41      "duration": "-1H",
    42      "gap": false,
    43      "date_time_after": "2025-10-26 TIME 02",
    44      "date_time_before": "2025-10-26 TIME 03",
    45      "overlap": true
    46    }
    47  }
    48}
    Note

    If all available parameters are included in the request, the following preference order will be used for querying time zone information or converting time. The priority is determined based on the presence of these options:

    1. Timezone name
    2. Geo Coordinates
    3. Location Adddress
    4. IP Address
    5. IATA Code
    6. ICAO Code
    7. UN/LO Code

    Response in Multiple Languages

    The geolocation information in the response from Time zone API when called using an IP address, can be retreived in the following languages:

    • English (en)
    • German (de)
    • Russian (ru)
    • Japanese (ja)
    • French (fr)
    • Chinese Simplified (cn)
    • Spanish (es)
    • Czech (cs)
    • Italian (it)
    • Korean (ko)
    • Persian (fa)
    • Portuguese (pt)

    By default, the API responds in English. You can change the response language by passing the language code as a query parameter lang . Here are an example to get time zone and geolocation information for an IPv4 IP Address '1.1.1.1' in Chinese language:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone?apiKey=API_KEY&ip=1.1.1.1&lang=cn'
    Note

    Multi language feature is available only for paid users.

    Convert Time between Time Zones

    You can convert a timestamp provided as a query parameter time from one time zone to another time zone. You can convert the provided timestamp in six ways:

    • Convert Time using Time Zone Names

    We can provide proper time zone names to find the time difference between the given time zones. Here as an example to convert timestamp from 'America/Argentina/Catamarca' to 'Asia/Kabul' providing as query parameters tz_from and tz_to respectively:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone/convert?apiKey=API_KEY&tz_from=America/Argentina/Catamarca&tz_to=Asia/Kabul&time=2024-12-08%2011:00'
    Response
    1{
    2    "original_time": "2024-12-08 11:00",
    3    "converted_time": "2024-12-08 18:30:00",
    4    "diff_hour": 7.5,
    5    "diff_min": 450
    6}

    • Convert Time using Location Coordinates

    One can also calculate the time difference between the two different locations' geo coordinates. Here is an example to get the time zone difference from latitude '34.0207305', longitude '-118.6919163', to latitude '53.4736827', longitude '-77.3977062', provided as query parameters lat_from , lat_from , and lat_to , long_to respectively:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone/convert?apiKey=API_KEY&lat_from=34.0207305&long_from=-118.6919163&lat_to=53.4736827&long_to=-77.3977062&time=2024-12-08%2006:00'
    Response
    1{
    2    "original_time": "2024-12-08 06:00",
    3    "converted_time": "2024-12-08 09:00:00",
    4    "diff_hour": 3,
    5    "diff_min": 180
    6}

    • Convert Time using Location Addresses

    We can calculate the time difference between the two different locations using the city address. Here is an example to find the time difference between the timezones of cities 'New York, USA' and 'Lahore, Pakistan' provided as query parameters location_from and location_to respectively:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone/convert?apiKey=API_KEY&location_from=New%20York,%20USA&location_to=Lahore,%20Pakistan&time=2024-12-08%2006:00'
    Response
    1{
    2    "original_time": "2024-12-08 06:00",
    3    "converted_time": "2024-12-08 16:00:00",
    4    "diff_hour": 10,
    5    "diff_min": 600
    6}

    • Convert Time using IATA Codes

    We can calculate the time difference of two airports using their IATA codes. Here's an example to calculate the time difference of airport 'Dubai International Airport' (DXB) and 'Heathrow Airport' (LHR) with their IATA codes provided as query parameters iata_from and iata_to respectively:

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone/convert?apiKey=API_KEY&iata_from=DXB&iata_to=LHR'
    Response
    1{
    2    "original_time": "2025-01-21 13:42:52",
    3    "converted_time": "2025-01-21 09:42:52",
    4    "diff_hour": 4,
    5    "diff_min": 240
    6}

    • Convert Time using ICAO Codes

    Similarly, We can calculate the time difference of two airports using their ICAO codes. Here's an example to calculate the time difference of airport 'Sydney Kingsford Smith Airport' (YSSY) and 'Beijing Capital International Airport' (ZBAA) with their IATA codes provided as query parameters icao_from and icao_to respectively, and the time to convert is provided as query parameter time :

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone/convert?apiKey=API_KEY&icao_from=YSSY&icao_to=ZBAA&time=2025-01-30%2009%3A00'
    Response
    1{
    2    "original_time": "2025-01-30 09:00",
    3    "converted_time": "2025-01-30 06:00:00",
    4    "diff_hour": 3,
    5    "diff_min": 180
    6}

    • Convert Time using UN/LOCODE

    We can also calculate the time difference between the two cities using their UN/LOCODE with the help of timezone API. Here's an example to calculate the time difference of cities 'Islamabad' (PKISB) and 'New York' (USNYC) with their UN/LOCODE provided as query parameters locode_from and locode_to respectively, and the time to convert is provided as query parameter time :

    cUrl
    curl -X GET 'https://api.ipgeolocation.io/v2/timezone/convert?apiKey=API_KEY&locode_from=PKISB&locode_to=USNYC&time=2025-02-28%209%3A00%3A00'
    Response
    1{
    2    "original_time": "2025-02-28 9:00:00",
    3    "converted_time": "2025-01-21 06:43:13",
    4    "diff_hour": 10,
    5    "diff_min": 600
    6}
    Note

    The time parameter takes the input in the following two formats: i) 'yyyy-MM-dd HH:mm', and ii) 'yyyy-MM-dd HH:mm:ss'. This parameter is optional and you can omit it to convert the current time between two coordinates, time zones, locations, airports or UN/LOCODEs.

    What's New in /v2/timezone and in /v2/timezone/convert

    Below are the key updates introduced in the /v2/timezone API endpoint compared to the previous /timezone version. Although, no new changes have been introduced in the /v2/timezone/convert:

    • All timezone-related data is now grouped under a single time_zone object, making the response more consistent with our overall API structure.
    • When calling /v2/timezone without any parameters or with ip=, the response now includes an ip field to indicate the IP address used for the lookup.
    • Several fields have been renamed for clarity or from camelCase to snake_case for consistency across all endpoints.
      • geo location
      • geo.loaction location.location_string
      • geo.country location.country_name
      • geo.state location.state_prov
      • airportDetails airport_details
      • loCodeDetails lo_code_details
      • loCodeDetails.city_name lo_code_details.city
      • loCodeDetails.administrative_country lo_code_details.country_name
      • timezone time_zone.name
      • timezone_offset time_zone.offset
      • timezone_offset_with_dst time_zone.offset_with_dst
      • dst_start.dateTimeAfter time_zone.dst_start.date_time_after
      • dst_start.dateTimeBefore time_zone.dst_start.date_time_before
      • dst_end.dateTimeAfter time_zone.dst_end.date_time_after
      • dst_end.dateTimeBefore time_zone.dst_end.date_time_before

    Reference to Time Zone API Response

    Below we have provided separate tables for each JSON object fields that can be returned by Time Zone API.

    • Standalone fields reference

    FieldTypeDescriptionCan be empty?
    ipstring

    The IP address used for the timezone lookup. Returned when queried using the ip= parameter or with no parameters.

    Yes

    time_zone json object reference

    FieldTypeDescriptionCan be empty?
    namestring

    The IANA timezone name/identifier for the location.

    No
    offsetnumber

    The Standard time zone offset from UTC in hours.

    No
    offset_with_dstnumber

    The time zone offset from UTC in hours, accounting for daylight saving time (DST) if found.

    No
    datestring

    The current date in 'YYYY-MM-DD' format.

    No
    date_timestring

    The current date and time in 'YYYY-MM-DD HH:mm:ss' format.

    No
    date_time_txtstring

    The current date and time in descriptive format for easy reading, formatted as 'EEEE, MMMM dd, yyyy HH:mm:ss'. (e.g., "Friday, November 08, 2024 08:44:26")

    No
    date_time_wtistring

    The date and time with time zone information in 'EEE, dd MMM yyyy HH:mm:ss Z' format. (e.g., "Fri, 08 Nov 2024 08:44:26 -0500")

    No
    date_time_ymdstring

    The date and time with timezone offset in ISO 8601 format 'YYYY-MM-DDTHH:mm:ss±HHMM'. (e.g., "2024-11-08T08:44:26-0500")

    No
    date_time_unixfloat

    The Unix timestamp representing the date and time in seconds (e.g., 1731073466.073).

    No
    time_24string

    The current time in 24-hour format 'HH:mm:ss'.

    No
    time_12string

    The current time in 12-hour format with AM/PM notation, formatted as 'HH:mm:ss AM/PM'.

    No
    weeknumber

    The week number of the year (1-52).

    No
    monthnumber

    The current month as a number (1-12).

    No
    yearnumber

    The four-digit current year (e.g., 2024).

    No
    year_abbrstring

    The two-digit abbreviation for the year (e.g., "24").

    No
    is_dstboolean

    Is the time zone in daylight savings?

    No
    dst_savingsnumber

    The amount of time added for daylight saving (in hours).

    No
    dst_existsboolean

    Indicates whether Daylight Saving Time (DST) is observed in the region. If true, the dst_start and dst_end objects will include detailed DST transition information.

    No
    dst_start.utc_timestring

    The date and time in UTC when DST begins.

    Yes
    dst_start.durationstring

    The time change that occurs when DST starts.

    Yes
    dst_start.gapboolean

    Is there is a missing hour (DST forward transition)?

    Yes
    dst_start.date_time_afterstring

    The local date and time that immediately follows the start of DST.

    Yes
    dst_start.date_time_beforestring

    The local date and time immediately before DST begins.

    Yes
    dst_start.overlapboolean

    Whether there is an overlap of time due to clocks being set back when DST starts.

    Yes
    dst_end.utc_timestring

    The date and time in UTC when DST ends.

    Yes
    dst_end.durationstring

    The time change that occurs when DST ends.

    Yes
    dst_end.gapboolean

    Is there is no gap (DST backward transition)?

    Yes
    dst_end.date_time_afterstring

    The local date and time that immediately follows the ends of DST.

    Yes
    dst_end.date_time_beforestring

    The local date and time immediately before DST ends.

    Yes
    dst_end.overlapboolean

    Whether there is an overlap of time due to clocks being set back when DST ends.

    Yes

    location json object reference

    FieldTypeDescriptionCan be empty?
    location_stringstring

    The provided location parameter as location.

    Yes
    continent_codestring

    The two-letter code of the continent (e.g., "NA").

    Yes
    continent_namestring

    The full name of the continent (e.g., "North America").

    Yes
    country_code2string

    The ISO 3166-1 alpha-2 two-letter country code (e.g., "US").

    Yes
    country_code3string

    The ISO 3166-1 alpha-3 three-letter country code (e.g., "USA").

    Yes
    country_namestring

    The common name of the country (e.g., "United States").

    Yes
    country_name_officialstring

    The official full name of the country (e.g., "United States of America").

    Yes
    is_euboolean

    Is the country belong to European Union?

    Yes
    state_provstring

    Name of the state/province/region.

    Yes
    state_codestring

    Code of the state/province/region.

    Yes
    districtstring

    Name of the district or county.

    Yes
    citystring

    Name of the city.

    Yes
    localitystring

    Smaller area, part or region of a city.

    Yes
    zipcodestring

    ZIP/Postal code of the place.

    Yes
    latitudestring

    The geographic latitude of the location.

    Yes
    longitudestring

    The geographic longitude of the location.

    Yes

    airport_detail json object reference

    FieldTypeDescriptionCan be empty?
    typestring

    Classification of the airport based on size and traffic.

    Yes
    namestring

    The full name of the airport.

    Yes
    latitudestring

    The latitude coordinate of the airport.

    Yes
    longitudestring

    The longitude coordinate of the airport.

    Yes
    elevation_ftnumber

    The elevation of the airport above sea level, measured in feet.

    Yes
    continent_codestring

    The two-letter code of the continent.

    Yes
    country_codestring

    The ISO 3166-1 alpha-2 code for the country where the airport is located.

    Yes
    state_codestring

    Code of the state/province/region where the airport is located.

    Yes
    citystring

    The city or administrative region that the airport serves.

    Yes
    iata_codestring

    The three-letter IATA airport code (e.g., "LHR").

    Yes
    icao_codestring

    The four-letter ICAO airport code (e.g., "EGLL").

    Yes
    faa_codestring

    The FAA location identifier, used primarily in the United States. May be empty if not applicable.

    Yes

    lo_code_details json object reference

    FieldTypeDescriptionCan be empty?
    lo_codestring

    A unique identifier for the location, often used in logistics and shipping (e.g., "USNYC").

    Yes
    citystring

    The name of the city or location associated with the lo_code.

    Yes
    state_codestring

    The code for the state, province or region.

    Yes
    country_codestring

    The ISO 3166-1 alpha-2 country code (e.g., "US").

    Yes
    country_namestring

    The name of the country in an administrative context.

    Yes
    location_typestring

    The type of the location as comma separated list of facilities (e.g., Port, Rail Terminal, Road Terminal, Airport).

    Yes
    latitudestring

    The latitude coordinate of the location.

    Yes
    longitudestring

    The longitude coordinate of the location.

    Yes
    Note

    lo_code - UN/LOCODE for all the countries and their cities are available at the UNECE website.

    Reference to Time Conversion API Response

    FieldTypeDescriptionCan be empty?
    original_timestring

    The original date and time before any conversion, presented in the format 'yyyy-MM-dd HH:mm:ss' (e.g., "2024-03-11 14:47:32").

    No
    converted_timestring

    The date and time after conversion, in the format 'yyyy-MM-dd HH:mm:ss' (e.g., "2024-03-11 02:47:32").

    No
    diff_hournumber

    The difference in hours between the original_time and the converted_time.

    No
    diff_minnumber

    The difference in minutes between the original_time and the converted_time.

    No

    Error Codes

    Time Zone API and Time Conversion API returns HTTP status code 200 for a successful API request along with the response.

    While, in case of a bad or invalid request, Time Zone API and Time Conversion API returns 4xx HTTP status code along with a descriptive message explaining the reason for the error.

    Below is a detailed explanation of the specific HTTP status codes and their corresponding error conditions:

    HTTP StatusDescription
    400
    Bad Request

    It is returned for one of the following reasons:

    • If the provided IPv4, IPv6 address, or domain name is invalid.

    • If special character(s) ( ) [ ] { } | ^ ` is passed in the API URL either as parameter or its value. Specially in case of API key.

    • If the provided IATA code to the request parameter iata_code is not in the format as three letter code AAA.

    • If the provided ICAO code to the request parameter icao_code is not in the format as four letter code AAAA.

    • If the provided UN/LOCODE to the request parameter lo_code is not in format as first two characters of country code, followed by the three alphanumeric characters of the city/region.

    • If the provided values to the request parameters lat and long are not numbers, or the values fall outside the acceptable latitude and longitude ranges. The valid range for latitude is between -90 and 90, and for longitude, it is between -180 and 180.

    • If the bogon or private IP address is provided to query the Time Zone information.

    • If the provided time zone name to the query parameter tz is wrong or not registered in the IANA time zone database.

    • If one of the query parameters tz_from and tz_to is provided and other is missing, for time conversion.

    • If one of the query parameters location_from and location_to is provided and other is missing, for time conversion.

    • If one of the query parameters lat_from , long_from , lat_to , and long_to is provided and other(s) is/are missing, for time conversion.

    • If the location address provided to one of the parameters location_from and location_to is invalid, for time conversion. City or state level address must be provided.

    • If the geographic coordinates provided to one of the parameters lat_from , long_from , lat_to , and long_to is/are not numbers, or the values fall outside the acceptable latitude and longitude ranges. The valid range for latitude is between -90 and 90, and for longitude, it is between -180 and 180.

    • If the time zone names provided to one of the parameters tz_from and tz_to is/are wrong or not registered in the IANA time zone database.

    • If none of the query parameter combination is provided for time conversion. tz_from and tz_to or location_from and location_to or lat_from , long_from , lat_to , long_to combination must be provided.

    401
    Unauthorized

    It is returned for one of the following reasons:

    • If API key (as apiKey URL parameter) is missing from the request to IP Geolocation API.

    • If an invalid (a random value) API key is provided.

    • If the API request is made from an unverified ipgeolocation.io account.

    • If your account has been disabled or locked to use by the admin due to abuse or illegal activity.

    • When the request to IP Geolocation API is made using API key for a database subscription

    • When the request to IP Geolocation API is made on the 'paused' subscription.

    • If you’re making API requests after your subscription trial has been expired.

    • If your active until date has passed and you need to upgrade your account.

    404
    Not Found

    It is returned for one of the following reasons:

    • If the IPv4, IPv6, or domain name does not not exists in our database.

    • If the IPv4, IPv6, or domain name is passed as a path variable, instead of url parameter as ip= .

    • If the location address provided to the request parameters location is invalid. City or state level address must be provided.

    • If the provided UN/LOCODE, IATA code or ICAO code to the query parameters lo_code , iata_code , or icao_code does not exists in our database.

    • If the wrong endpoint is called, that does not exists in our API.

    405
    Method Not Allowed
    • If wrong HTTP request method is used for calling the endpoints. Only GET method is allowed for both endpoints /timezone and /timezone/convert .

    429
    Too Many Requests

    It is returned for one of the following reasons:

    • If the API usage limit has reached for the free subscriptions, or paid subscriptions with the status 'past due', 'deleted' or 'trial expired'.

    • If the surcharge API usage limit has reached against the subscribed plan.

    499
    Client Closed Request
    • If the client has set the very short request or connection timeout, leading to the server closing the request prematurely.

    5XX
    Server Side Error
    • If a 500 (Internal Server Error), 502 (Bad Gateway), 503 (Service Unavailable), 504 (Gateway Timeout), or 505 (HTTP Version Not Supported) status code is returned, it indicates an issue on our end. Please contact us with your request at [email protected] for further assistance.

    API SDKs

    To facilitate the developers, we have added some SDKs for various programming languages. The detailed documentation on how to use these SDKs is available in the respective SDK's documentation page linked below.

    Our SDKs are also available on Github. Feel free to help us improve them. Following are the available SDKs:

    Frequently Asked Questions

    You can find the time zone of any IP address by using an IP to Time Zone API. Our API instantly detects the time zone based on the IP address you provide. Simply send an API request with the IP, and you'll receive details like the time zone name, current local time, GMT offset, DST status, and the geolocation information of the IP address as well.
    When you make a request to the Time Zone API without specifying an IP address, it automatically detects your public IP from the request header. It then identifies your approximate geolocation and returns the corresponding time zone, along with local time details.
    Yes, ipgeolocation.io offers a free plan for its Time Zone API. The free tier includes up to 1,000 API requests per day. If you need higher limits, advanced features, or dedicated support, paid plans are available with scalable pricing.
    Yes, our Time Zone API automatically detects daylight saving time. The API response includes fields such as is_dst (indicating if DST is active) and dst_savings (showing how much time is added for DST), further details of dst_start and dst_end object if dst_exits is true.
    The ipgeolocation.io Time Zone API supports both JSON and XML formats and returns responses in JSON format by default. For getting a response in XML format, specify it as request param output=xml.
    IPGeolocation.io’s time zone API provides multiple ways to query time zone information including search by IP address, geo coordinates of a location, city address, time zone name specified by IANA, LOCODE, IATA code, and ICAO code.
    Yes, the Time Zone API supports retrieving time zone information using the 5-character UN/LOCODE of any city worldwide. In addition to time zone data, the API response includes relevant details about the city associated with the provided code.
    Yes, the Time Zone API returns geolocation information along with time zone details. When you query the API using an IP address or city name, a geo object is included in the response containing geolocation details. Similarly, when you query using a UN/LOCODE, the corresponding city information is provided, and for IATA or ICAO codes, the response includes the airport's geolocation details.
    The IP Geolocation Time Zone API by ipgeolocation.io is one of the most accurate available. It leverages a comprehensive database of IP address locations and time zones, ensuring precision and real-time updates, including automatic adjustments for daylight saving time.
    Yes! By using our Time Zone API, you can retrieve the current local time of any IP address. The API response includes the precise local time, GMT offset, and daylight saving time details if they are in effect in the observed time zone.
    Integration is simple! You can call the Time Zone API via HTTP GET requests. The response is provided in JSON format, making it easy to integrate with most web and mobile applications. SDKs and code examples are available in languages like Java, PHP, JS, TS, and more.
    Yes, the Time Zone API works with both desktop and mobile IP addresses and returns the time zone information along with the geolocation information for the queried IP address.
    Our IP to Time Zone API is highly accurate, thanks to its daily updated IP geolocation database. The accuracy for time zone detection is typically 99%, ensuring you get reliable time zone data, including DST and UTC offset details.
    Yes, IPGeolocation.io’s Time Zone API allows you to search for time zone information using either the IATA or ICAO airport codes. This feature is especially useful for building international travel applications that require accurate time zone data along with airport details.
    Our Time Conversion API offers multiple ways to convert time from one source to another. You can perform time conversions using time zone names, geographic coordinates (latitude and longitude), city names, UN/LOCODE, and IATA or ICAO airport codes. This flexibility makes it easy to integrate accurate time conversions into a variety of applications.