Handling Dates

Hi

I am trying to convert a string to date with the following code - but giving me some parsing error

using Dates
df = DateFormat("d-b-y");
dt = Date("28-Feb-99",df)

I am getting the following error:

ArgumentError: Unable to parse date time. Expected directive Delim(-b-) at char 3
julia> Date("28-Feb-99",dateformat"d-u-y")
0099-02-28

See the date format spec

and this bug

1 Like

Thanks for your reply. Does this mean it is still a bug? Also why the year is showing 0099?

It’s debatable whether it’s technically a “bug” but it would be breaking to change it before Julia 2.0 so we’re stuck with it for now.

Your date says year 99 and it doesn’t want to guess which century you mean. You can add + Year(1900) if you want.

1 Like

Oh - that’s bad - but hey thank you for your help :slight_smile: