2020-11-08
The other day I ran into this timezone issue in Ruby, and that’s when I discovered the tz database for the first time. There were almost no blog posts explaining how it works, so I decided to write one myself.
We’ll be using the alpine:3.12 Docker image to test things out.
What is it?
The tz database is a standardized collection of timezone data and rules used by most systems worldwide to handle timezone conversions.
Here are the official documentation and the source code on GitHub. The NEWS file is used as a replacement for the more common CHANGELOG in other projects.
tzdata package
The tz database and its related CLI tools are distributed as the tzdata package. Let’s download it within our container:
$ docker run -it alpine:3.12 / # apk add tzdata fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.12/community/x86_64/APKINDEX.tar.gz (1/1) Installing tzdata (2020c-r0) Executing busybox-1.31.1-r19.trigger OK: 9 MiB in 15 packages
To check which version your tzdata package is on, use the package manager’s version command:
... continue reading