Skip to content


Subversion checkout URL

You can clone with
Download ZIP
a set of erlang utilities for the Olson timezone database files
Erlang Makefile
Branch: master

update tz script; fix for inconsistent months; badLine debug tweak

A recent tzdata download contained more non-timezone files, so the
cleanup script in the README was updated to remove them.

backzone:Isle_of_Man used "March" once instead of "Mar", so instead of
fighting it, ezic_date:month_to_num/1 now parses full month names as well.

The `badLine` error related to trying to parse invalid timezone files
wasn't offering up its arguments, so it's switched to erlang:error/1
with arguments wraped in a tuple. This is to help identify which file
might be invalid.

Also, Readme has updated thank yous.
latest commit d95e92d1dc
@drfloob authored
Failed to load latest commit information.
src update tz script; fix for inconsistent months; badLine debug tweak
test Merge pull request #11 from arkdro/master
.gitignore handled case where zone and rule both end. dealing with Tripoli recur…


ezic is a native erlang library for working with timezones. It parses the Olson timezone database files, allowing native erlang timezone lookup and zone conversions without the use of shell commands or a UNIX system.

See the tz database page for more information about the Olson database.


Erlang/OTP didn't have a native timezone library, so I wrote ezic to fill that void.

The recommended way of handling timezones in erlang involves setting the system environment variable TZ to the desired timezone, then calling erlang time functions. As far as I can tell, this technique has a few key issues:

  • it only works on *nix systems,
  • it depends on your system's timezone data (preventing custom timezone hackery), and
  • you can create race conditions if you aren't careful about it

ezic doesn't have these problems. ezic is, however, a young project with who-knows-how-many problems of its own.


  • ezic:localtime(TimeZone) -> datetime()
  • ezic:utc_to_local(universal_datetime(), TimeZone) -> local_datetime()
  • ezic:local_to_utc(local_datetime(), TimeZone) -> universal_datetime()

Example Setup

# setup your local environment
mkdir -p priv/tzdata

# download the timezone data files
wget ''
tar -xvzf tzdata-latest.tar.gz -C priv/tzdata

# remove a few troublesome files
cd priv/tzdata
rm *.sh *.gz *.tab factory *.pl *.awk *.list [A-Z]*

# build and run ezic
cd -
make all run
1> application:start(ezic).
2> ezic:localtime("Australia/Adelaide").


This project is in the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute the original code, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

Contributed Code

To maintain ezic's status as a public domain work, all contributions must also be dedicated to the public domain.


A big thanks to ezic's contributors:

The decision to release this into the public domain was inspired by the (anti-) license of the SQLite project.

Something went wrong with that request. Please try again.