logo RSSTwitter

Free IP address geolocation tools

Timezone database

Timezone database in SQL format associated with world countries and region with all timestamps of daylight saving time (DST). The data for each zone is from the tz database (AKA Olson database) and the association of countries regions was made manually with Statoids.

Tables content
  • fips_regions : World regions by country using the FIPS standard
  • iso3166_countries : World countries using the ISO3166 standard
  • timezones : Timezones name
  • timezones_data : The data for all timezones. gmtoff in seconds
Limitation

Some regions (very few) have multiple timezones. For example Ontario in Canada (08, CA) has 3 timezones : America/Toronto, America/Atikokan, America/Rainy_River. Since the precision of the database is limited to regions, the timezone in the most populated area was selected (America/Toronto for Ontario).

For countries without regions, simply set the region code to 00 in the query.

Usage
Simple example to get current timezone for Quebec, Canada :
SELECT tzd.gmtoff, tzd.isdst, tz.name
FROM `timezones_data` tzd
JOIN `timezones` tz ON tz.id = tzd.timezone
WHERE tzd.timezone = (
SELECT `timezone`
FROM `fips_regions`
WHERE `country_code` = 'CA'
AND `code` = '10' )
AND tzd.start < UNIX_TIMESTAMP( now( ) )
ORDER BY tzd.start DESC
LIMIT 1
API
We made a simple API to get current GMT offset for a specific country/region.
If you use this service on a regular basis, please consider making a donation. Our API are totally free but we need donations in order to pay for hosting and dedicated servers.
XML
http://www.ipinfodb.com/tz_query.php?country_code=CA&region_code=02&output=xml
JSON
http://www.ipinfodb.com/tz_query.php?country_code=CA&region_code=02&output=json
JSON with callback
http://www.ipinfodb.com/tz_query.php?country_code=CA&region_code=02&output=json&callback=yourFunction
Raw output
http://www.ipinfodb.com/tz_query.php?country_code=CA&region_code=02&output=raw

API query limit

We do not have a specific daily limit but queries that are at a rate faster than 2 per second will be put in "queue". If you stay below 2 queries/second everything will be normal. If you go over the limit, you will still get an answer for all queries but they will be slowed down to about 1 per second. This should not affect most users but for high volume websites, you can either use the database on your server or we can whitelist your IP for 5$/month (simply use the donate form and leave a comment with your server IP). Good programming practices such as not querying our API for all page views (you can store the data in a cookie or a database) will also help not reaching the limit.

Servers location and uptime

We have 3 servers. Two are are load balanced & highly available (ldirectord + heartbeat setup).They are located in Montreal, Canada and used for the primary domain (ipinfodb.com). We also have a third server located in Los Angeles, US (backup.ipinfodb.com or us.ipinfodb.com). It can be used as the first server you query but keep in mind that it's not redundant as our main server in case of hardware failure. Our goal is to have over 99.99% uptime on the main server. 100% uptime can be reached by adding a failover server (eg backup.ipinfodb.com) in your code.

Keeping in touch for updates

The best way to get updates and news is with our RSS feed or on Twitter. Also, we now offer rsync at this address :

rsync://rsync.ipinfodb.com/ipinfodb
Support

For all non googable questions, visit the forum. We also offer custom integration.