How to build a ZIP code to time zone database in 5 steps

GeoPostcodes-How to Build a Zip Code to Time Zone Database
Updated: September 1, 2026
Table of Contents

Key takeaways

  • ZIP code to time zone mapping enables timely customer communication
  • Database creation requires postcode and time zone data integration
  • Geographic matching links codes to time zones based on coordinates
  • Commercial databases offer better accuracy and regular updates
  • GeoPostcodes’ time zone dataset maps ZIP codes to IANA time zones, with UTC and DST offsets, across 247 countries, delivered as a self-hosted file.

Introduction

Timing matters when it comes to contacting customers. It increases engagement and response. However, determining the right time for a large base of customers spread across different zones is challenging, especially in countries like the USA, Canada, Mexico, Brazil, and Russia, which span multiple time zones.

In this article, we’ll infer time zones from international postcodes. Zip codes (also known as postal codes or postcodes) are an element of standard address formatting. Since they are part of user information, zip codes are often used to determine time zones.

Try Our ZIP Code Lookup Tool

Enter any ZIP code in the USA

Need International Coverage?

Get access to location data from 247 countries.

What is time zone by ZIP code mapping?

It is a process of associating a time zone with each postal code of a dataset. This requires access to:

  • ZIP codes with additional information (administrative divisions, coordinates, etc.)
  • Time zone rules

Mapping ZIP codes to time zones can be complex, especially in the USA, where states, counties, or even smaller regions can have more than one time zone. To accurately map ZIP codes, you need to find a source that correlates ZIP codes with states/counties, assigns time zones to states/counties, and encodes exceptions where a ZIP code falls into multiple time zones.

🔗 GeoPostcodes offers a complete ZIP code to time zone reference database covering 247 countries. It can be used to convert time from one time zone to another. Each entry includes verified UTC offsets, DST rules, Windows/Olson mappings, and country codes.

IsoCountryOlsonUTCDSTZoneZone name
ADAndorraEurope/Andorra+01:00+02:00CET/CESTCentral European Time
AEUnited Arab EmiratesAsia/Dubai+04:00+04:00GSTArabian Standard Time
AFAfghanistanAsia/Kabul+04:30+04:30AFTAfghanistan Time
AGAntigua and BarbudaAmerica/Antigua-4:00:00-4:00:00ASTAtlantic Standard Time
AIAnguillaAmerica/Anguilla-4:00:00-4:00:00ASTAtlantic Standard Time
ALAlbaniaEurope/Tirane+01:00+02:00CET/CESTCentral European Time
AMArmeniaAsia/Yerevan+04:00+04:00AMTArmenia Time
AOAngolaAfrica/Luanda+01:00+01:00WATWest Africa Time
AQAntarcticaAntarctica/Casey+11:00+11:00+11Central Pacific Standard Time
AQAntarcticaAntarctica/Davis+07:00+07:00+07SE Asia Standard Time
AQAntarcticaAntarctica/DumontDUrville+10:00+10:00+10West Pacific Standard Time
AQAntarcticaAntarctica/Macquarie+10:00+11:00AEST/AEDTAustralian Eastern Standard Time

Rules get more complicated when you target international data, which is the purpose of this article. We will not work with individual time zone rules but use a more convenient method for global data, focusing on geographical matching between postcodes and mapped time zones.

Area codes & time zones US © Wikimedia Commons

Assigning time zones to ZIP codes

We’ll discuss where to find the data, how to upload it, and how to use it to assign time zones to postcodes.

Sourcing postcode data

You first need to identify a good source of international postcodes with geographical information. Free candidates include GeoNames and OpenStreetMap.

From those sources, you can access postal codes for a number of countries (and even more if you combine them) along with their latitude and longitude. This tutorial will use GeoNames.

GeoPostcodes-Zip code to timezone
GeoPostcodes – Excel Sample

💡 Open source data is often unreliable, incomplete, and lacks regular updates to catch up with ZIP code changes. Our location data is frequently updated, relying on more than 1,500 sources. Download our free country to time zone conversion table .

Sourcing time zone and Daylight Saving Time

The Internet Assigned Numbers Authority (IANA) publishes the most widely used time zone data, including rules and codes for capturing different time zones and accessing past and future time switches from Standard Time to Daylight Saving Time.

We’ll use a map of the official IANA time zones maintained on Time Zone Boundary Builder for our geographical mapping. You can download the geojson file in the Releases folder.

Take the file with oceans if you want to cover the whole earth. Take the one without if you don’t want to set a time zone to points that would fall into oceans (indicating coordinates are likely wrong).

The world time zones map, according to the IANA 2022g release, looks like this:

IANA World time zones map
IANA World time zones map, using an equal area projection, which appears distorted compared to commonly used equal angle maps; those equal angle maps. Those equal angle maps, however, give greater spatial weight to features located further from the Equator.

The map only includes the zone name. To use the zones, you’ll need more information (such as the Standard and Daylight Saving Times of each zone, and so on). To obtain additional details, you can process the official IANA files. If you don’t want to run that, or extract data from Wikipedia (scraping or extracting this table), you can get a consolidated CSV file from GeoPostcodes.

Uploading the data to a common database

To combine the data sources, you’ll benefit from uploading them to a common framework. While it’s perfectly possible to handle the processes with widespread programming languages and libraries (e.g. Python and GeoPandas), we’ll use a database to store and query our data in this tutorial.

Our preference goes to PostgreSQL with the PostGIS extension, a leading open-source database engine with state-of-the-art geographical data processing features. It offers all the functionalities you need in this case:

  • Uploading the different data sources
  • Matching them using geographical attributes or other keys
  • Capable of storing, querying, and exporting the results

It also natively handles time zones, including the IANA zone names, making it a great choice if you want to manage your time data in the same framework as your postcode data.

💡 For a deeper understanding of how ZIP code data can be integrated into SQL databases efficiently, explore our guide on creating a ZIP code database in SQL.

1. First, set up a PostgreSQL/PostGIS database. There are numerous tutorials available for that, but we suggest this one.

2. After the database is set up, you can upload your different sources to it. We’re assuming in this tutorial that you’ll upload everything to a schema named timezones.

All the commands we show here can be run from any SQL client (like pgAdmin or DBeaver), but also using the psql interactive terminal.

The general psql command syntax looks like this:

psql -tA -U $username -d $database -h $host -c "#sql_command"

It’s useful to set up a password file to avoid being prompted for your password every time.

3. Now, it’s time to upload your files. You’ll need to unzip all the files to a common directory (/home/timezones, in this tutorial). Then, you can upload their data to your PostgreSQL database with the following commands.

Geonames.csv

  • Create a table to host the data:
CREATE TABLE timezones.geonames_postcodes(
   iso char(2), 
   postcode varchar(20), 
   place varchar(180), 
   adm1_name varchar(80), 
   adm1_code varchar(20), 
   adm2_name varchar(80), 
   adm2_code varchar(20), 
   adm3_name varchar(80), 
   adm3_code varchar(20), 
   lat float, 
   lng float, 
   geo_accuracy int
);
  • Upload the data, here using the copy command from psql:
psql -tA -U $username -d $database -h $host -c "copy timezones.geonames_postcodes FROM /home/timezones/allCountries.txt CSV HEADER DELIMITER AS E't' ;"
  • Alternatively, you can also use the COPY from a SQL client, and most clients offer functionalities to upload a CSV directly from the graphical interface.

IANA geojson

  • Leverage the ogr2ogr GDAL command to directly upload the geojson file with time zone polygons to our database:
ogr2ogr -f "PostgreSQL" -clo SCHEMA=timezones PG:"dbname=postgres user=#user" combined.json -nln timezone_polygons

Time Zone Information

  • You can upload the file available from GeoPostcodes’ website, GPC-TIMEZONES.csv with the following commands. First, create a table, then upload the CSV:
CREATE TABLE timezones.timezones_info(
   iso char(2), 
   country text, 
   timezone text, 
   std_offset char(6), 
   dst_offset char(6), 
   zone_abbrevation char(10), 
   zone_alt_name text
);
psql -tA -U $username -d $database -h $host -c "copy timezones.timezones_info FROM /home/timezones/GPC-TIMEZONES.csv CSV HEADER DELIMITER AS ';' ;"

Preparing geographical data

Once you’ve uploaded the necessary data, it’s a good idea to add a spatial index on the polygon database to speed up the spatial joins:

CREATE INDEX timezones_geom_idx ON timezones.timezone_polygons USING SPGIST(wkb_geometry);

You’ll also benefit from creating a geometry column in the Geonames table, which you can then invoke for the spatial joins:

ALTER TABLE timezones.geonames_postcodes ADD COLUMN geom geometry(point,4326);
UPDATE timezones.geonames_postcodes
SET geom = ST_Makepoint(lng,lat);

Linking postcodes and time zones with geographical matching

After all your data is stored in the PostgreSQL database, leverage the geographical attributes in the geonames_postcodes and timezone_polygons tables to join them. Use the coordinates of every postcode and check which time zone polygon they fall in.

You can perform this with the following query, creating a new table to store your results:

CREATE TABLE timezones.postcodes_timezones AS
   SELECT g.iso, g.postcode, t.tzid
   FROM timezones.geonames_postcodes g
   JOIN timezones.timezone_polygons t ON ST_Intersects(g.geom,t.wkb_geometry);

After this process, some postcodes might be mapped to several time zones. This can happen either because time zone polygons overlap (it’s infrequent, but it happens) or because the postcode is associated with several localities that fall in more than one time zone.

To properly match the time zone most associated with each postal code, run:

CREATE TABLE timezones.postcodes_tz AS
   SELECT iso, postcode, mode() WITHIN GROUP(ORDER BY tzid) AS timezone
   FROM timezones.postcodes_timezones
   GROUP BY iso, postcode;

Note that in case of a tie, mode will arbitrarily select one candidate.

Once the time zone has been identified, consider gathering extra information about it, like its Standard and Daylight Saving Times. If you want to pull in the information contained in the timezones_info table, extend the query to:

SELECT
   pt.iso,
   pt.postcode,
   mode() WITHIN GROUP(ORDER BY pt.tzid) AS timezone,
   ti.std_offset,
   ti.dst_offset,
   ti.zone_abbrevation,
   ti.zone_alt_name
FROM timezones.postcodes_timezones pt
LEFT JOIN timezones.timezones_info ti ON ti.timezone = pt.tzid
GROUP BY 1, 2, 4, 5, 6, 7;

The following screenshot shows the result, where you can see every postcode mapped to a single time zone, with high-level information about the time zone:

Every postcode mapped to a single time zone

🔗 Download free ZIP code to time zone Excel sample here. For over 15 years, we’ve built a GeoPostcodes worldwide ZIP code database from over 1,500 sources.

Known issues with the postcode to time zone database

The IANA time zone polygons are released shortly after any updates to the IANA rules, so the main issues you might encounter will relate to your postal data source.

Aside from the issue with retrieving a single time zone per postcode in the case of a tie, there are three other areas for potential hiccups to consider:

  • Country coverage
  • Coordinates accuracy
  • Out-of-date postcode data

Country coverage

Open-source providers like GeoNames and OpenStreetMap provide postcodes for most countries spanning more than one time zone. Countries with a single time zone can be mapped to time zones with country-wide rules from the timezones.timezones_info table.

Coordinates accuracy

OpenStreetMap and GeoNames deliver generally reliable coordinates. But an issue with GeoNames is that coordinates are rounded and consequently mapped to a grid in some areas.

These coordinates will get you to the correct time zone or a neighboring one, putting you within two hours of the actual local time (accounting for Daylight Saving Time variations).

Out-of-date Postcode data

OpenStreetMap and GeoNames do not always have the most complete and up-to-date postcode data. As a result, you could be missing postcodes. Some OpenStreetMap postcodes should just be discarded altogether, as they don’t respect the country’s postcode format.

If you can accommodate small errors (in other words, assign a time zone that’s close to correct), you can look for the closest postcode in your available data. Postcodes usually follow a hierarchical structure, so look for a postcode sharing the same leading characters. For instance, postcode 6999 should be considered closer to 6990 than 7000, and T2H 0K7 is closer to T2H 0Y0 than T2H 1K7.

Note of course that approximations can add up in cases like that. If you link a postcode to another alphabetically close postcode, that second postcode can itself have approximative coordinates.

Bonus: How to determine a customer’s time zone from country data

If you’re looking for a quick fix to start out, and you know the customer’s country, a country-to-time-zone lookup gets you 80% of the way there.

GeoPostcodes maintains a free country-to-time-zone reference file covering every country. Each row includes the ISO country code, the Olson time zone identifier (e.g., Europe/Paris), UTC offset, DST offset, and zone abbreviation.

How to use it

  1. Pull the customer’s country from your CRM.
  2. Look up that country in the reference file. In addition to the free dataset, GeoPostcodes provides a full database including up-to-date time zone information for every postcode-locality combination.
  3. For single-time-zone countries — most of the world — the single row returned is your answer.
  4. For countries with multiple time zones (US, Canada, Russia, Brazil, Australia, Mexico), the file returns every zone.
  5. Pair with city or state to pick the right one, or default to the country’s most populous zone.

How to combine with call data

If your CRM also stores past call or meeting timestamps, cross-check the location-derived time zone against the times of day when the customer responds. When both signals agree, confidence is high. When they conflict, treat the customer as traveling and default to call activity as the more current signal.

Conclusion

While you can derive time zone information from postcodes using freely available data and software, the quality of the result is highly dependent on the data sources you use.

We’ve highlighted some common issues and explained some workarounds, but you might want to consider a commercial option if you need:

  • Higher accuracy than the ±2 hours solved for in this article
  • Extra information, such as the dates and times of switching to/from Daylight Saving Time
  • Data that’s always up to date

GeoPostcodes maintains a worldwide database of postcodes, including up-to-date time zone information for every postcode-locality combination. When a postcode is linked to several time zones, you can access all of them and use locality to filter.

You can have a look at the Timezone product sheet or even browse the data for yourself. But don’t hesitate to contact us or request a quote if you want to know more!

If you’re looking for ways to leverage ZIP code data for enhanced business insights and efficiency, explore how to add geocoded ZIP codes to Salesforce, ensure accuracy with address validation in Microsoft Dynamics 365, create impactful visuals by mapping ZIP codes in Tableau, and optimize logistics by calculating distances between ZIP codes using Python.

FAQ

How is a ZIP code/time zone database useful?

Timing is crucial for successful customer outreach, whether it’s reminding them of reservations, conducting surveys, or sending marketing messages.

In call centers, timing can be even more critical when live interaction is necessary.

What information does a ZIP code/time zone database contain?

ZIP code/time zone databases identify the time zone associated with each ZIP code, enabling accurate time-based calculations and scheduling.

They are widely used in scheduling systems, online services, and international communication platforms.

How frequently is the ZIP code/time zone database updated?

Sometimes, when we update time zones or country information, we may also adjust administrative divisions, which could affect the time zones of specific localities, but it’s rare.

How can a ZIP code to timezone database benefit the postal service?

A ZIP code to timezone database increases postal service efficiency by accurately timestamping delivery events, optimizing delivery schedules, and ensuring timely parcel handling across different time zones.

Can one US ZIP code span two time zones?

Yes. A single ZIP code can span two time zones, especially near state borders in Texas, Idaho, and Kansas.

A lookup based on ZIP code alone can return the wrong time zone in these cases.

GeoPostcodes’ database links each postcode to every time zone it touches, so you can filter by locality to get the correct one.

How do I convert IANA time zone names to Windows time zone names?

IANA names (like Europe/Paris) and Windows time zone names (like Romance Standard Time) follow different naming systems, so you need a mapping table to convert between them.

The Unicode CLDR project maintains this mapping in its windowsZones.xml file, and libraries like ICU and NodaTime apply it automatically.

If your system stores IANA identifiers, as GeoPostcodes’ time zone data does, this mapping step is what lets Windows-based applications read them correctly.

Is there a free ZIP code to time zone CSV?

GeoPostcodes offers a free reference file, but it maps countries to time zones, not individual ZIP codes.

Each row includes the ISO country code, the IANA (Olson) time zone identifier, UTC offset, DST offset, and zone abbreviation.

If you need ZIP-code-level precision, GeoPostcodes’ paid ZIP code database maps time zones and DST directly to each ZIP code across 247 countries, delivered as a self-hosted dataset.

What is a ZIP Code to timezone API?

A ZIP Code to timezone API is a digital tool that allows users to input a ZIP Code and receive the corresponding timezone information.

This API is commonly used in applications that require local time calculation based on geographical data.

Is ZIP Code for city or country?

ZIP Codes are used to designate specific geographic areas within a country, primarily for postal purposes.

In the United States, ZIP Codes can represent areas within cities, entire cities, or even rural regions.

Related posts

GeoPostcodes inverted logo