TimeZones ERROR: ArgumentError: Unknown time zone "Europe/Warsaw"

Hello,

I’m trying to use the TimeZones package (JuliaPro 0.6.3, TimeZones 0.7.2 on Ubuntu Linux 18.04). Trying to create a timezone with any argument other than UTC fails. Any suggestions on what I am doing wrong? Thanks!

julia> import TimeZones
INFO: Recompiling stale cache file /home/dara/.juliapro-0.6.3.1/lib/v0.6/Compat.ji for module Compat.
INFO: Recompiling stale cache file /home/dara/.juliapro-0.6.3.1/lib/v0.6/TimeZones.ji for module TimeZones.

julia> TimeZones.TimeZone(“UTC”)
UTC

julia> TimeZones.TimeZone(“Europe/Warsaw”)
ERROR: ArgumentError: Unknown time zone “Europe/Warsaw”
Stacktrace:
[1] (::TimeZones.##1#3{String})() at /juliapro/JuliaPro-0.6.3.1/JuliaPro/pkgs-0.6.3.1/v0.6/TimeZones/src/TimeZones.jl:70
[2] get!(::TimeZones.##1#3{String}, ::Dict{AbstractString,Base.Dates.TimeZone}, ::String) at ./dict.jl:449
[3] Base.Dates.TimeZone(::String) at /juliapro/JuliaPro-0.6.3.1/JuliaPro/pkgs-0.6.3.1/v0.6/TimeZones/src/TimeZones.jl:64

julia> TimeZones.timezone_names()
ERROR: SystemError: unable to read directory /juliapro/JuliaPro-0.6.3.1/JuliaPro/pkgs-0.6.3.1/v0.6/TimeZones/deps/compiled: No such file or directory
Stacktrace:
[1] readdir(::String) at ./file.jl:415
[2] timezone_names() at /juliapro/JuliaPro-0.6.3.1/JuliaPro/pkgs-0.6.3.1/v0.6/TimeZones/src/discovery.jl:15

julia>

Europe/Warsaw is not the name of a time zone. See this list for time zones and their abbreviations:

Actually it is:

“Europe/Warsaw” is the very first example in TimeZones’s documentation: Types - TimeZones.jl

@dhazeghi Maybe you need to build the package first:

Pkg.build("TimeZones")

Thanks @StefanKarpinski and @giordano - that does the trick! I must’ve messed up the installation some time ago because if I do Pkg.rm() and Pkg.add(), everything appears to be fine.

(In the process of testing, I also discovered that some of the timezones that the Linux ‘date’ command reports e.g. ‘PST’ are not actually recognized by the system as valid timezones - Ubuntu 18.04 only has ‘PST8PDT’. Yuck)

Not sure I deserve any thanks on this one—my only contribution was misinformation :grimacing: