How do I convert String into Date object

Chris Rebert clp2 at
Sat Aug 13 22:09:13 CEST 2011

On Sat, Aug 13, 2011 at 12:14 PM, MrPink <tdsimpson at> wrote:
> Is this the correct way to convert a String into a Date?
> I only have dates and no time.
> import time, datetime
> oDate = time.strptime('07/27/2011', '%m/%d/%Y')
> print oDate

from datetime import datetime
the_date = datetime.strptime('07/27/2011', '%m/%d/%Y').date()


More information about the Python-list mailing list