Python date string to date object

Solution 1:

You can use strptime in the datetime package of Python:

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

Solution 2:

import datetime
datetime.datetime.strptime('24052010', '%d%m%Y').date()