I have a string like this
"1st January 2014"
I want to parse it into a datetime.date
. I can do this:
If the date is 1 January 2014
I make this: replace(' ','')
then datetime.strptime(SecondDateString, "%d%B%Y").date()
But this doesn't work when the day has st
, nd
, rd
, or th
.
Edit:
you may say that I myself remove the st
, nd
, rd
, or th
and then use my own way above, yes this is a solution but I am asking if python has already had something for me.