I have a large sales database the first column of which is the purchase date. The problem is some of these dates are entered in DD.MM.YY
format, some in YY.MM.DD
and some in YYYY/MM/DD
. I want to make them all to same format. What is the cleanest way I can do this?
Note 1: I'm thinking of doing a series of if
s but that would be a lot of conditions so I'm wondering if there is a cleaner shortcut.
Note 2: An additional complication is that the dates are in Jalaali calender and not Gregorian. I have the function that will convert them to gregorian but I need to pass the correct year, month, day
arguments to it; this is why I want to bring them all to a single format. But additionally, this means that if you offer some "Gregorian-only" solutions, like dateutil.parser
, it might not work.