Can anyone suggest a date peocedure...

Michiel Overtoom motoom at xs4all.nl
Thu Jul 10 20:26:42 EDT 2008


Ron wrote:

> Now all I need to know is how to
> plug the date into the datetime object from a string.

You could use simple string manipulation:

 >>> import datetime
 >>> a="20081031"
 >>> d=datetime.date(int(a[0:4]),int(a[4:6]),int(a[6:8]))
 >>> d
datetime.date(2008, 10, 31)
 >>> print d
2008-10-31

Greetings,




More information about the Python-list mailing list