converting time tuple to datetime struct

gry at ll.mit.edu gry at ll.mit.edu
Thu Mar 3 09:44:24 EST 2005


[your "%b" is supposed to be the abbreviated month name, not the
number.  Try "%m"]

In [19]: datetime.datetime(*time.strptime("20-3-2005","%d-%m-%Y")[:6])
Out[19]: datetime.datetime(2005, 3, 20, 0, 0)

Cheers,
   George




More information about the Python-list mailing list