Parsing a CSV file with 2-digit year

I have a file with dates formatted like this:
5/7/10 2:11 for the date 2010-5-7 and the time 2:11 am.
I’m having the hardest time getting that read in properly.
I’m trying something like CSV.read("Data.csv", dateformat=dateformat"m/d/yy H:M"), but my dates are all formatted like this: 0010-5-7.
I have two questions about this:
a) What happened to the yy formatting in Julia 1.0? Am I mis-remembering this from Python?
b) How can I read this data in with the right dates?
Many thanks for any pointers.

1 Like

How is Julia supposed to know that you mean "20"10 and not "00"10 (or indeed 1000, 3000, etc.)?
I’m afraid that you’ll need to add Dates.Year(2000) to your DateTimes after importing them.
So something like this:

dt = CSV.read("Data.csv", dateformat=dateformat"m/d/yy H:M")
dt .+= Dates.Year(2000)
1 Like

Well, maybe what threw me off was the representation 0010. That is never what I want.
Now that I think about it, maybe I was just expecting this to be represented as 2-digits as well, but fair enough, that’s easy to change in my own output methods. The leading 0s just look weird in the jupyter output and on the time axis of my plots.
Thanks for your suggestion. Adding a year like that works fine.

The representation is yyyy, so a year of 10 is represented as 0010. But Dates.Year will show you it is just 10.