diff --git a/dev/api-private/index.html b/dev/api-private/index.html index 163bc485..9cdb2b93 100644 --- a/dev/api-private/index.html +++ b/dev/api-private/index.html @@ -44,4 +44,4 @@ 1919-09-16 2:00s 0 - 1944-04-03 2:00s 1:00 Ssource

Interpretation

TimeZones.transition_rangeFunction
transition_range(dt::DateTime, tz::VariableTimeZone, context::Type{Union{Local,UTC}}) -> UnitRange

Finds the indexes of the tz transitions which may be applicable for the dt. The given DateTime is expected to be local to the time zone or in UTC as specified by context. Note that UTC context will always return a range of length one.

source
TimeZones.interpretFunction
interpret(dt::DateTime, tz::VariableTimeZone, context::Type{Union{Local,UTC}}) -> Array{ZonedDateTime}

Produces a list of possible ZonedDateTimes given a DateTime and VariableTimeZone. The result will be returned in chronological order. Note that DateTimes in the local context typically return 0-2 results while the UTC context will always return 1 result.

source
TimeZones.shift_gapFunction
shift_gap(local_dt::DateTime, tz::VariableTimeZone) -> Tuple

Given a non-existent local DateTime in a TimeZone produces a tuple containing two valid ZonedDateTimes that span the gap. Providing a valid local DateTime returns an empty tuple. Note that this function does not support passing in a UTC DateTime since there are no non-existent UTC DateTimes.

Aside: the function name refers to a period of invalid local time (gap) caused by daylight saving time or offset changes (shift).

source
TimeZones.first_validFunction
first_valid(local_dt::DateTime, tz::VariableTimeZone, step::Period)

Construct a valid ZonedDateTime by adjusting the local DateTime. If the local DateTime is non-existent then it will be adjusted using the step to be after the gap. When the local DateTime is ambiguous the first ambiguous DateTime will be returned.

source
TimeZones.last_validFunction
last_valid(local_dt::DateTime, tz::VariableTimeZone, step::Period)

Construct a valid ZonedDateTime by adjusting the local DateTime. If the local DateTime is non-existent then it will be adjusted using the step to be before the gap. When the local DateTime is ambiguous the last ambiguous DateTime will be returned.

source

TZFile

TimeZones.TZFile.readFunction
TZFile.read(io::IO) -> Function

Read the content of an I/O stream as a POSIX tzfile to produce a TimeZone. As the tzfile format does not include the name of the interpreted time zone this function returns a closure which takes the single argument name::AbstractString and when called produces a TimeZone instance.

source
TimeZones.TZFile.writeFunction
TZFile.write(io::IO, tz::TimeZone; version::Char=TZFile.WRITE_VERSION)

Writes the time zone to the I/O stream in the POSIX tzfile format.

source

Etc.

TimeZones.UTCOffsetType
UTCOffset

A UTCOffset is an amount of time subtracted from or added to UTC to get the current local time – whether it's standard time or daylight saving time.

source
TimeZones.@optionalMacro
@optional(expr)

Creates multiple method signatures to allow optional arguments before required arguments. For example:

f(a=1, b=2, c) = ...

becomes:

f(a, b, c) = ...
 f(a, c) = f(a, 2, c)
-f(c) = f(1, 2, c)
source
TimeZones.parse_tz_formatFunction
parse_tz_format(str) -> TimeZone

Parse the time zone format typically provided via the "TZ" environment variable. Details on the format can be found under the man page for tzset.

source
TimeZones.tryparse_tz_formatFunction
tryparse_tz_format(str) -> Union{TimeZone, Nothing}

Like parse_tz_format, but returns either a value of the TimeZone, or nothing if the string does not contain a valid format.

source
Base.hashMethod
hash(::ZonedDateTime, h)

Compute an integer hash code for a ZonedDateTime by hashing the utc_datetime field. hash(:utc_instant, h) is used to avoid collisions with DateTime hashes.

source
Dates.guessMethod
guess(start::ZonedDateTime, finish::ZonedDateTime, step) -> Integer

Given a start and end date, indicates how many steps/periods are between them. Defining this function allows StepRanges to be defined for ZonedDateTimes.

source
+f(c) = f(1, 2, c)source
TimeZones.parse_tz_formatFunction
parse_tz_format(str) -> TimeZone

Parse the time zone format typically provided via the "TZ" environment variable. Details on the format can be found under the man page for tzset.

source
TimeZones.tryparse_tz_formatFunction
tryparse_tz_format(str) -> Union{TimeZone, Nothing}

Like parse_tz_format, but returns either a value of the TimeZone, or nothing if the string does not contain a valid format.

source
Base.hashMethod
hash(::ZonedDateTime, h)

Compute an integer hash code for a ZonedDateTime by hashing the utc_datetime field. hash(:utc_instant, h) is used to avoid collisions with DateTime hashes.

source
Dates.guessMethod
guess(start::ZonedDateTime, finish::ZonedDateTime, step) -> Integer

Given a start and end date, indicates how many steps/periods are between them. Defining this function allows StepRanges to be defined for ZonedDateTimes.

source
diff --git a/dev/api-public/index.html b/dev/api-public/index.html index 0492208f..b726fc27 100644 --- a/dev/api-public/index.html +++ b/dev/api-public/index.html @@ -103,4 +103,4 @@ Local Time Change: 00:00 → 00:00 (Forward) Offset Change: UTC-11/+1 → UTC+13/+1 Transition From: 2011-12-29T23:59:59.999-10:00 -Transition To: 2011-12-31T00:00:00.000+14:00source +Transition To: 2011-12-31T00:00:00.000+14:00source diff --git a/dev/arithmetic/index.html b/dev/arithmetic/index.html index 24a06b5e..86196e28 100644 --- a/dev/arithmetic/index.html +++ b/dev/arithmetic/index.html @@ -52,4 +52,4 @@ 2016-01-01T14:00:00+00:00 2016-01-01T15:00:00+00:00 2016-01-01T16:00:00+00:00 - 2016-01-01T17:00:00+00:00

Note that 2016-01-01T17:00:00 in UTC corresponds to 2016-01-01T18:00:00 in "Europe/Warsaw", which is the requested endpoint of the range.

+ 2016-01-01T17:00:00+00:00

Note that 2016-01-01T17:00:00 in UTC corresponds to 2016-01-01T18:00:00 in "Europe/Warsaw", which is the requested endpoint of the range.

diff --git a/dev/conversions/index.html b/dev/conversions/index.html index aa872e53..90958df5 100644 --- a/dev/conversions/index.html +++ b/dev/conversions/index.html @@ -40,4 +40,4 @@ "20150806+02:00" julia> Dates.format(zdt, "yyyy-mm-dd HH:MM ZZZ") -"2015-08-06 22:25 CEST" +"2015-08-06 22:25 CEST" diff --git a/dev/current/index.html b/dev/current/index.html index 1d0faadd..5c76044b 100644 --- a/dev/current/index.html +++ b/dev/current/index.html @@ -3,4 +3,4 @@ in expression starting at REPL[1]:1
julia> a - bERROR: UndefVarError: `a` not defined
julia> today(tz"Pacific/Midway"), today(tz"Pacific/Apia")ERROR: LoadError: ArgumentError: The time zone "Pacific/Midway" is of class `TimeZones.Class(:LEGACY)` which is currently not allowed by the mask: `TimeZones.Class(:FIXED) | TimeZones.Class(:STANDARD)` in expression starting at REPL[3]:1

You should be careful not to use today() when working with ZonedDateTimes as you may end up using the wrong day. For example:

julia> midway, apia = tz"Pacific/Midway", tz"Pacific/Apia"ERROR: LoadError: ArgumentError: The time zone "Pacific/Midway" is of class `TimeZones.Class(:LEGACY)` which is currently not allowed by the mask: `TimeZones.Class(:FIXED) | TimeZones.Class(:STANDARD)`
 in expression starting at REPL[1]:1
julia> ZonedDateTime(today() + Time(11), midway)ERROR: UndefVarError: `midway` not defined
julia> ZonedDateTime(today() + Time(11), apia) # Wrong date; with the current rules apia should be one day ahead of midwayERROR: UndefVarError: `apia` not defined
julia> ZonedDateTime(today(midway) + Time(11), midway)ERROR: UndefVarError: `midway` not defined
julia> ZonedDateTime(today(apia) + Time(11), apia)ERROR: UndefVarError: `apia` not defined

Alternatively, you can use the todayat function which takes care of this for you:

julia> todayat(Time(11), tz"Pacific/Midway")ERROR: LoadError: ArgumentError: The time zone "Pacific/Midway" is of class `TimeZones.Class(:LEGACY)` which is currently not allowed by the mask: `TimeZones.Class(:FIXED) | TimeZones.Class(:STANDARD)`
-in expression starting at REPL[1]:1
julia> todayat(Time(11), tz"Pacific/Apia")2023-07-19T11:00:00+13:00
+in expression starting at REPL[1]:1
julia> todayat(Time(11), tz"Pacific/Apia")2023-07-20T11:00:00+13:00 diff --git a/dev/faq/index.html b/dev/faq/index.html index 980e4b24..e1c6d781 100644 --- a/dev/faq/index.html +++ b/dev/faq/index.html @@ -28,4 +28,4 @@ TimeZones.TZData.compile(max_year=2220) ZonedDateTime(DateTime(2215), TimeZone("Europe/Warsaw")) end -2215-01-01T00:00:00+01:00 +2215-01-01T00:00:00+01:00 diff --git a/dev/index.html b/dev/index.html index 5f3bb1fa..437f0722 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,4 +1,4 @@ Introduction · TimeZones.jl

Time Zones

TimeZones.jl provides access to the IANA time zone database (also referred to as the tz database) to the programming language Julia. This library can handle any time zone in the tz database but some have excluded by default due to them being deemed as historical (such as "Etc/*").

Installation

The TimeZones package extends the Dates module provided by Julia version 0.4. In order to use this package you will need to have Julia 0.4 or higher installed on your system. Details on downloading and installing Julia can be found on the language homepage.

Once Julia is installed you can simply install TimeZones using the package manager. First open a Julia interactive session and run:

julia> using Pkg  # on Julia 0.7+
 
-julia> Pkg.add("TimeZones")

This command will install the latest version of TimeZones, automatically download the latest tz database, and convert the data into an Julia optimized format.

+julia> Pkg.add("TimeZones")

This command will install the latest version of TimeZones, automatically download the latest tz database, and convert the data into an Julia optimized format.

diff --git a/dev/rounding/index.html b/dev/rounding/index.html index 0ee6986f..d1a23310 100644 --- a/dev/rounding/index.html +++ b/dev/rounding/index.html @@ -25,4 +25,4 @@ 1996-10-26T00:00:00+06:30 julia> round(zdt, Dates.Day) -ERROR: AmbiguousTimeError: Local DateTime 1996-10-26T00:00:00 is ambiguous within Asia/Colombo +ERROR: AmbiguousTimeError: Local DateTime 1996-10-26T00:00:00 is ambiguous within Asia/Colombo diff --git a/dev/search/index.html b/dev/search/index.html index 0d72c5d0..8372e3d4 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · TimeZones.jl

Loading search...

    +Search · TimeZones.jl

    Loading search...

      diff --git a/dev/types/index.html b/dev/types/index.html index 84a0a8c3..834d60c5 100644 --- a/dev/types/index.html +++ b/dev/types/index.html @@ -46,4 +46,4 @@ FixedTimeZone("-04:30") FixedTimeZone("+12:34:56") FixedTimeZone("FOO", -6 * 3600) # 6 hours in seconds

      Constructing a ZonedDateTime works similarly to VariableTimeZone:

      julia> ZonedDateTime(1960, 1, 1, tz"UTC")
      -1960-01-01T00:00:00+00:00
      +1960-01-01T00:00:00+00:00