How to construct a Date array?

under Julia 0.6, I could do:

dr = Dates.Date(2001) : Dates.Date(2010)

I didn’t use this script under Julia 0.7, so didn’t get deprecate messages. Now under 1.0.1, this statement gets an error:

ERROR: MethodError: Cannot `convert` an object of type Int64 to an object of type Day
Closest candidates are:
  convert(::Type{Day}, ::Week) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Dates/src/periods.jl:421
  convert(::Type{Day}, ::Hour) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Dates/src/periods.jl:428
  convert(::Type{Day}, ::Minute) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.0/Dates/src/periods.jl:428

It’s not obvious which way I should go from the messages. Can anyone help please?

Got it. It’s now:

dr = Dates.Date(2001) : Day(1) : Dates.Date(2010)

1 Like

This will give yearly increments

using Dates
dr = Date.(2001:2010)