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


#1

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>


#2

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


#3

Actually it is:


“Europe/Warsaw” is the very first example in TimeZones’s documentation: https://timezonesjl.readthedocs.io/en/stable/types/

@dhazeghi Maybe you need to build the package first:

Pkg.build("TimeZones")

#4

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)


#5

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