Timezone API
The address API enables you to request an address and get the details about the address in return. Be specific with your address parameters as the request can return multiple results.
Data
Please URL encode all parameter values.
NOTICE
Searching for an address is a complex operation. The request can take up to several hundred miliseconds.
We recommend using the address API asynchronously.
Returns address, timezone and datetime information. Please notice: The request can return multiple results. Be specific when requesting an address if you intent only to have one result returned. Date/time defaults to when the request was made.
$ curl https://timezoneapi.io/api/address/?Hacker+Way+1+Menlo+Park+California&token=TOKEN
// Get JSON object
$jsondata = file_get_contents("https://timezoneapi.io/api/address/?Hacker+Way+1+Menlo+Park+California&token=TOKEN");
// Decode
$data = json_decode($jsondata, true);
// Request OK?
if($data['meta']['code'] == '200'){
// Example: Get the city parameter
echo "City: " . $data['data']['addresses']['0']['city'] . "<br>";
// Example: Get the users time
echo "Time: " . $data['data']['addresses']['0']['datetime']['date_time_txt'] . "<br>";
}
// Require
const request = require('request');
// Request
request('https://timezoneapi.io/api/address/?Hacker+Way+1+Menlo+Park+California&token=TOKEN', function(err, res, dat){
// Parse
var data = JSON.parse(dat);
// Request OK?
if(data.meta.code == '200'){
// Log
console.log(data);
// Example: Get the city parameter
var city = data.data.addresses[0].city;
// Example: Get the users time
var time = data.data.addresses[0].datetime.date_time_txt;
}
});
// Get JSON object
$.getJSON('https://timezoneapi.io/api/address/?Hacker+Way+1+Menlo+Park+California&token=TOKEN', function(data){
// Request OK?
if(data.meta.code == '200'){
// Log
console.log(data);
// Example: Get the city parameter
var city = data.data.addresses[0].city;
alert(city);
// Example: Get the users time
var time = data.data.addresses[0].datetime.date_time_txt;
alert(time);
}
});
# Require
require 'json'
require 'open-uri'
# Get JSON and parse
data = JSON.parse(open('https://timezoneapi.io/api/address/?Hacker+Way+1+Menlo+Park+California&token=TOKEN').read)
# If OK, get values
if data['meta']['code'] = 200
city = data['data']['addresses']['0']['city']
puts city
time = data['data']['addresses']['0']['datetime']['date_time_txt']
puts time
end
# Import
import requests
# Get
response = requests.get('https://timezoneapi.io/api/address/?Hacker+Way+1+Menlo+Park+California&token=TOKEN')
# Parse JSON
data = response.json()
# If ok, get values
if data['meta']['code'] = 200:
City = data['data']['addresses']['0']['city']
print City
Time = data['data']['addresses']['0']['datetime']['date_time_txt']
print Time
Returns
{ "meta": { "code": "200" }, "data": { "addresses_found": "1", "addresses": [{ "street": "Hacker Way", "street_abbr": "Hacker Way", "street_number": "1", "street_subpremise": null, "postal_code": "94025", "postal_code_suffix": "1456", "city": "Menlo Park", "county": "San Mateo County", "state": "California", "state_code": "CA", "country": "United States", "country_code": "US", "formatted_address": "1 Hacker Way, Menlo Park, CA 94025, USA", "location": "37.4846262,-122.1478991", "timezone": { "id": "America\/Los_Angeles", "location": "34.05222,-118.24278", "country_code": "US", "country_name": "United States of America", "iso3166_1_alpha_2": "US", "iso3166_1_alpha_3": "USA", "un_m49_code": "840", "itu": "USA", "marc": "xxu", "wmo": "US", "ds": "USA", "phone_prefix": "1", "fifa": "USA", "fips": "US", "gual": "259", "ioc": "USA", "currency_alpha_code": "USD", "currency_country_name": "UNITED STATES", "currency_minor_unit": "2", "currency_name": "US Dollar", "currency_code": "840", "independent": "Yes", "capital": "Washington", "continent": "NA", "tld": ".us", "languages": "en-US,es-US,haw,fr", "geoname_id": "6252001", "edgar": "" }, "datetime": { "date": "12\/11\/2023", "date_time": "12\/11\/2023 03:45:24", "date_time_txt": "Sunday, December 11, 2023 03:45:24", "date_time_wti": "Sun, 11 Dec 2023 03:45:24 -0800", "date_time_ymd": "2023-12-11T03:45:24-08:00", "time": "03:45:24", "month": "12", "month_wilz": "12", "month_abbr": "Dec", "month_full": "December", "month_days": "31", "day": "11", "day_wilz": "11", "day_abbr": "Sun", "day_full": "Sunday", "year": "2023", "year_abbr": "16", "hour_12_wolz": "3", "hour_12_wilz": "03", "hour_24_wolz": "3", "hour_24_wilz": "03", "hour_am_pm": "am", "minutes": "45", "seconds": "24", "week": "49", "offset_seconds": "-28800", "offset_minutes": "-480", "offset_hours": "-8", "offset_gmt": "-08:00", "offset_tzid": "America\/Los_Angeles", "offset_tzab": "PST", "offset_tzfull": "Pacific Standard Time", "tz_string": "PST8PDT,M3.3.0/2,M11.2.0/2", "dst": "false", "dst_observes": "true", "timeday_spe": "late_night", "timeday_gen": "night" } }] } }
We've made it easy for you to test out our API's. Simply click the "Token" link on each API page and a temporary token is generated instantly. You can generate up to five test tokens. Each token is valid for 20 requests. When you're ready to put the code into production then sign up for a plan to get a service token.
Service Token (for testing)
A test token has been generated for you. It's good for 20 requests. Please notice: When using a test token the request reponse time is reduced drastically.