Home

Awesome

BigQuery Public Dataset for Timezone Data

An public mirror of the tzdb (timezone database) from IANA and the timezone boundaries within BigQuery.

This is being offered as a "best effort" replication to support anybody who would need this information within BigQuery .

Releases

The data will be mirrored into the BigQuery datasets on a best-effort basis; for example the availability of new version's within this dataset could lag behind the releases found from both sources.

What is BigQuery?

Bigquery is a managed data warehouse from the Google Cloud platform; the official documentation can be found here . There can be costs from Google Cloud when consuming this data; it is advisable to checkout the pricing page before consuming.

Contents

Release Version Identifiers

The release version identifiers are based on the IANA timezone release identifiers, today this is in the format of YYYYx, for example 2023d.

EU vs US

All data is replicated into both the EU and US Multi Regions. The datasets all have a suffix to represent which region the data is stored within. Both regions contain all global data and are provided as a convenience to the consumer.

Latest Version

Two datasets contain the most recent released version for each table. It could be that the difference sources have a different latest version as each source is updated independently. Each table within the latest datasets has a column showing the current version.

There are some more technical tables (such as raw JSON tables) that are not available within the latest version and need to be sourced per version; this is to ensure that the latest tables and content are stable (where-as source JSON might change.

Dataset ProjectEU DatasetUS Datasettzdb versionBoundary version
tz-datalatest_EUlatest_US2024b2024b

Version Datasets

As an alternative to the latest version datasets, previous versions are kept as a historical record and to ensure you can migrate to the next version at your own pace. The sources have many years of history; however we are starting from the 2023 releases.

VersionDataset ProjectEU DatasetUS DatasetHas tzdbHas Boundary
2024btz-datarelease_2024b_EUrelease_2024b_USYY
2024atz-datarelease_2024a_EUrelease_2024a_USYY
2023dtz-datarelease_2023d_EUrelease_2023d_USYY
2023ctz-datarelease_2023c_EUrelease_2023c_USY
2023btz-datarelease_2023b_EUrelease_2023b_USYY
2023atz-datarelease_2023a_EUrelease_2023a_USY

Detailed Contents

Here is a list of the tables currently available. Unless otherwise mentioned the schema of these tables is the same across versions. For more detailed descriptions of the contents I would suggest reading the documentation from the source directly.

Table NameSourceIn Latest?DescriptionNotes
timezonestimezone-boundary-builderYComprehensive list of timezones (excluding oceans)See examples below
timezones-1970timezone-boundary-builderYList of timezones valid since 1970 (excluding oceans)Since 2023d
timezones-nowtimezone-boundary-builderYTimezones currently valid (excluding oceans)Since 2023d
timezones-with-oceanstimezone-boundary-builderYComprehensive list of timezones
timezones-with-oceans-1970timezone-boundary-builderYList of timezones valid since 1970Since 2023d
timezones-with-oceans-nowtimezone-boundary-builderYTimezones currently validSince 2023d
timezones_jsontimezone-boundary-builderJSON import data, Comprehensive list of timezones (excluding oceans)
timezones-1970_jsontimezone-boundary-builderJSON import data, List of timezones valid since 1970 (excluding oceans)Since 2023d
timezones-now_jsontimezone-boundary-builderJSON import data, Timezones currently valid (excluding oceans)Since 2023d
timezones-with-oceans_jsontimezone-boundary-builderJSON import data, Comprehensive list of timezones
timezones-with-oceans-1970_jsontimezone-boundary-builderJSON import data, List of timezones valid since 1970Since 2023d
timezones-with-oceans-now_jsontimezone-boundary-builderJSON import data, Timezones currently validSince 2023d
tzdb_linksIANA tzdbYTimezone links (aliases)
tzdb_rulesIANA tzdbYTimezone rules
tzdb_zonesIANA tzdbYTimezones

Examples

Lookup a timezone from a set of coordinates

SELECT
    timezone_id
FROM
    `tz-data.latest_EU.timezones`
WHERE
    ST_WITHIN(
        ST_GEOGPOINT(
            /* longitude */ -0.13948559859956436,
            /* latitude */ 51.5029659891868
        ),
        geometry
    );
LIMIT 1

Return Value:

timezone_id
Europe/London

Get timezones for multiple places

Using the standard list, if a place is within the ocean it will not return a timezone.

WITH places AS (
  SELECT "Buckingham Palace" AS place,51.500833 AS lat,-0.141944 AS long,
  UNION ALL SELECT "Null Island" AS place,0.0 AS lat,0.0 AS long,
  UNION ALL SELECT "Statue of Liberty" AS place,40.689167 AS lat,-74.044444 AS long,
  UNION ALL SELECT "Sydney Opera House" AS place,-33.858611 AS lat,151.214167 AS long,
  UNION ALL SELECT "Taj Mahal" AS place,27.175 AS lat,78.041944 AS long
)
SELECT
  p.place,
  p.lat,
  p.long,
  t.timezone_id,
  CURRENT_TIMESTAMP AS utc_time,
  DATETIME(CURRENT_TIMESTAMP,t.timezone_id) AS local_time
FROM
  places p
  LEFT JOIN `tz-data.latest_EU.timezones` t
    ON ST_WITHIN(
        ST_GEOGPOINT(
          p.long,
          p.lat
        ),
        t.geometry
    )
ORDER BY
  p.place ASC

Return Value:

placelatlongtimezone_idutc_timelocal_time
Buckingham Palace51.500833-0.141944Europe/London2023-12-31 08:21:33.747150 UTC2023-12-31 08:21:33.747150
Null Island0.00.02023-12-31 08:21:33.747150 UTC
Statue of Liberty40.689167-74.044444America/New_York2023-12-31 08:21:33.747150 UTC2023-12-31 03:21:33.747150
Sydney Opera House-33.858611151.214167Australia/Sydney2023-12-31 08:21:33.747150 UTC2023-12-31 19:21:33.747150
Taj Mahal27.17578.041944Asia/Kolkata2023-12-31 08:21:33.747150 UTC2023-12-31 13:51:33.747150

Get timezones for multiple places, including the oceans

Here NULL island returns a timezone, as it within the ocean.

WITH places AS (
  SELECT "Buckingham Palace" AS place,51.500833 AS lat,-0.141944 AS long,
  UNION ALL SELECT "Null Island" AS place,0.0 AS lat,0.0 AS long,
  UNION ALL SELECT "Statue of Liberty" AS place,40.689167 AS lat,-74.044444 AS long,
  UNION ALL SELECT "Sydney Opera House" AS place,-33.858611 AS lat,151.214167 AS long,
  UNION ALL SELECT "Taj Mahal" AS place,27.175 AS lat,78.041944 AS long
)
SELECT
  p.place,
  p.lat,
  p.long,
  t.timezone_id,
  CURRENT_TIMESTAMP AS utc_time,
  DATETIME(CURRENT_TIMESTAMP,t.timezone_id) AS local_time
FROM
  places p
  LEFT JOIN `tz-data.latest_EU.timezones` t
    ON ST_WITHIN(
        ST_GEOGPOINT(
          p.long,
          p.lat
        ),
        t.geometry
    )
ORDER BY
  p.place ASC

Return Value:

placelatlongtimezone_idutc_timelocal_time
Buckingham Palace51.500833-0.141944Europe/London2023-12-31 08:21:33.747150 UTC2023-12-31 08:21:33.747150
Null Island0.00.0Etc/GMT2023-12-31 08:21:33.747150 UTC2023-12-31 08:21:33.747150
Statue of Liberty40.689167-74.044444America/New_York2023-12-31 08:21:33.747150 UTC2023-12-31 03:21:33.747150
Sydney Opera House-33.858611151.214167Australia/Sydney2023-12-31 08:21:33.747150 UTC2023-12-31 19:21:33.747150
Taj Mahal27.17578.041944Asia/Kolkata2023-12-31 08:21:33.747150 UTC2023-12-31 13:51:33.747150

Licenses