What you were looking for is Dates.Year
, but that does not work the way you want it either because a number of days cannot be converted into years as years have a variable number of days.
Two possible solutions are:
julia> Dates.year(d1) - Dates.year(d2)
9
julia> Dates.days(d1-d2)/365.25
9.100616016427105
PS: have a read through Please read: make it easier to help you.