Converting Day to Int

I think you’re looking for Dates.value:

help?> Dates.value
Dates.value(x::Period) → Int64

For a given period, return the value associated with that period. For example, value(Millisecond(10)) returns 10 as an integer.

For example:

julia> using Dates

julia> d = Day(42)
42 days

julia> Dates.value(d)
42
5 Likes