Datetime difference

julia> using Dates

julia> ts1 = DateTime("2019-10-01T12:00:00.00")
2019-10-01T12:00:00

julia> ts2 = DateTime("2019-10-02T03:23:40.00")
2019-10-02T03:23:40

julia> canonicalize(ts2-ts1)
15 hours, 23 minutes, 40 seconds

Some more manipulation:

julia> using Unitful

julia> using Pipe

julia> @pipe ustrip.(p.periods) |> join(_,":")
"15:23:40"

Regarding the use of Pipe, you can see endless discussions in recent thread here: https://discourse.julialang.org/t/fixing-the-piping-chaining-issue/89654 or just read the manual here (more useful): https://github.com/oxinabox/Pipe.jl

1 Like