# DateTime: Time division

**URL:** https://discourse.julialang.org/t/datetime-time-division/95285
**Category:** General Usage
**Tags:** dates, algebra
**Created:** [February 27, 2023, 7:40pm UTC](https://discourse.julialang.org/t/datetime-time-division/95285 "2023-02-27T19:40:48Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [February 27, 2023, 8:50pm UTC](https://discourse.julialang.org/t/datetime-time-division/95285/4 "2023-02-27T20:50:11Z")

</div>

Check also this [related thread](https://discourse.julialang.org/t/operations-with-time-duration/64983).

From which your example could be written, with the help of `CompoundPeriods`, as:

```julia
using Dates, CompoundPeriods
import Base: / , *
/(t::Dates.CompoundPeriod, x::Real) = canonicalize(Dates.CompoundPeriod(Millisecond(round(Int64,Dates.toms(t)/x))))
*(t::Dates.CompoundPeriod, x::Real) = canonicalize(Dates.CompoundPeriod(Millisecond(round(Int64,Dates.toms(t)*x))))

hr = Hour(1) |> CompoundPeriod
t1 = DateTime(2023, 1, 3)
r = 7.4
t2 = t1 + hr/r # 2023-01-03T00:08:06.486

```

---

_[View the full topic](https://discourse.julialang.org/t/datetime-time-division/95285)._
