I am trying to read dates in the format such as “09Aug2015”. From my understanding of datetime objects the format is duyyyy
. In fact when converting a date to that format it looks quite like what I want:
date_august = Dates.format(now(), DateFormat("duyyyy"))
However, when trying to read back the date I get an error:
Date(string(date_august),DateFormat("duyyyy"))
ERROR: ArgumentError: Unable to parse date time. Expected directive DatePart(u) at char 2
Stacktrace:
[1] macro expansion at /Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Dates/src/parse.jl:104 [inlined]
[2] tryparsenext_core(::String, ::Int64, ::Int64, ::DateFormat{:duyyyy,Tuple{Dates.DatePart{'d'},Dates.DatePart{'u'},Dates.DatePart{'y'}}}, ::Bool) at /Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Dates/src/parse.jl:38
[3] macro expansion at /Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Dates/src/parse.jl:150 [inlined]
[4] tryparsenext_internal at /Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Dates/src/parse.jl:125 [inlined]
[5] parse at /Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Dates/src/parse.jl:282 [inlined]
[6] Date(::String, ::DateFormat{:duyyyy,Tuple{Dates.DatePart{'d'},Dates.DatePart{'u'},Dates.DatePart{'y'}}}) at /Applications/Julia-1.5.app/Contents/Resources/julia/share/julia/stdlib/v1.5/Dates/src/io.jl:503
[7] top-level scope at none:1
Any ideas on how am I to read those kinds of dates? Thks!