>>> import datetime >>> datetime.datetime.strptime('24052010', "%d%m%Y").date() datetime.date(2010, 5, 24)