I want to create my own date parser. I like parser.parse()
function but if I have:
date1 = '2022/11/10'
date2 = '10/11/2022'
parser.parse(date1)
parser.parse(date2)
Then the results are:
datetime.datetime(2022, 11, 10, 0, 0)
datetime.datetime(2022, 10, 11, 0, 0)
I want to always first try to parse the day with month between day and year. So the parser.parse(date2)
should return November, not October. What is more I want to parse only the dates which includes days, month, and years, so parser.parse("20") should return an error and not datetime.datetime(2023, 1, 20, 0, 0)
. I would simply write my own function to parse dates (couple of if
statements) but I'm afraid that it might works very slow with big data.