I am trying to convert the date format '31-Dec-09' to '2009-12-31' in Python with the following code:
df = ['19-Jan-19', '4-Jan-19']
f = [datetime.datetime.strptime(x,'%d-%mmm-%y').strftime('%Y-%m-%d') for x in df]
print(f)
Getting the following error:
time data '9-Jan-19' does not match format '%d-%mmm-%y'
I have read somewhere that matching a two-digit year '00' would require a lowercase y instead of an upper case one. Either way, I am getting the same error so I guess something else is wrong. Any help?