view raw
elif elif - 6 months ago 66
Python Question

Python date string to date object

How do I convert a string to a date object in python?

The string would be:

(corresponding to the format:

I don't want a datetime.datetime object, but rather a


You can use strptime in the datetime package of Python:

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