I have a string which may contain date into any of the below format
20200618
18-june-2020
Could someone please help me in how to obtain the date from the string? Thanks
I have a string which may contain date into any of the below format
20200618
18-june-2020
Could someone please help me in how to obtain the date from the string? Thanks
dateutil's parser can help:
from dateutil import parser
for d in ["20200618", "18-june-2020"]:
print(parser.parse(d))
2020-06-18 00:00:00
2020-06-18 00:00:00