How do I convert String into Date object
tdsimpson at gmail.com
Sat Aug 13 21:26:25 CEST 2011
I have file of records delimited by spaces.
I need to import the date string and convert them into date datatypes.
'07/27/2011' 'Event 1 Description'
'07/28/2011' 'Event 2 Description'
'07/29/2011' 'Event 3 Description'
I just discovered that my oDate is not an object, but a structure and
not a date datatype.
I'm stumped. Is there a way to convert a string into a date datatype
for comparisons, equality, etc?
On Aug 13, 3:14 pm, MrPink <tdsimp... at gmail.com> 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
More information about the Python-list