I've a list of dates. Some of the dates get parsed using from dateutil import parser
, but others dont. The list of dates that dont get parsed are :-
date1 = 'Tue Feb 10 2015 12 52pm IST'
date2 = '10 February 15 08 35am'
date3 = '2015 02 10 08 24 26 UTC'
I parse the dates in the following manner :-
try:
date = re.sub('[^a-zA-Z0-9\n\.]', ' ', date)
print date
print (parser.parse(date)).date()
except Exception,e:
print e
How can I parse all the date format? These are the dates scrapped from a webpage.
The final output should be of the format "Monday, 09 Feb"