Home

Awesome

TZDB - IANA Time Zone Database for Delphi/FreePascal

Test TZDB/CLDR Bump Release

Introduction

TZDB is an offline, in-process compiled database for IANA's (https://www.iana.org/time-zones) TZDB project.

The source code is compatible with Delphi XE+ and FreePascal 3+, though some components are only available for Delphi.

The current version of TZDB is compiled with 2024a version of IANA TZDB and the latest Windows alias translation table (from CLDR project).

API Documentation and Code Examples.

Manually updating to latest TZDB from IANA

This project follows the IANA releases quite closely, usually with 1-2 weeks delay. If you are inclined to update the library manually use the shell script located in the repository: update-compile.sh.

The shell script runs under MacOS, Linux or Windows WSL. You will need Free Pascal compiler installed though.

Using the Library

To use TZDB you only require one file: TZDB.pas. Download it and simply add it to your uses clause. This unit contains the whole pre-compiled TZ database and all the code required to interpret it.

All the other files in the project are optional. After you download the files to your local project, simply include the TZDB unit in the uses clause.

Simplest example looks like:

uses TZDB;

begin
  LTimeZone := TBundledTimeZone.GetTimeZone('Africa/Cairo');
  WriteLn(LTimeZone.ToUniversalTime(Now));
end.

A large number of methods are provided on the TBundledTimeZone class that allow date/time manipulation.

Things of Interest

There are a large number of misconceptions when it comes to time zones in general. And TZDB tries to deal with them in specific ways. The following list should shed some light on issue one might encounter during the use of this library:

Time Zone Visualizer

The Time Zone Visualizer is a development tool we use to display time zone details. It is currently only supported on Windows:

Screen shot