# Datetime difference

**URL:** <https://discourse.julialang.org/t/datetime-difference/90075>\
**Category:** General Usage\
**Tags:** question, dates\
**Created:** [November 10, 2022, 9:56pm UTC](https://discourse.julialang.org/t/datetime-difference/90075 "2022-11-10T21:56:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)\
**Post date:** [November 11, 2022, 1:56am UTC](https://discourse.julialang.org/t/datetime-difference/90075/2 "2022-11-11T01:56:42Z")

</div>

```julia
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
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](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](https://github.com/oxinabox/Pipe.jl)

---

_[View the full topic](https://discourse.julialang.org/t/datetime-difference/90075)._
