changing format of time duration.

Günther Dietrich gd.usenet at spamfence.net
Fri Jun 4 05:14:21 EDT 2010


Gabriel Genellina <gagsl-py2 at yahoo.com.ar> wrote:

>Try the strptime method with a suitable format, like this (untested):
>delta = now2-now1
>delta.strftime('%H:%M:%S.%f')

Throws an exception:

|Traceback (most recent call last):
|  File "<stdin>", line 1, in <module>
|AttributeError: 'datetime.timedelta' object has no attribute 'strftime'

What seems logical, since the documentation doesn't mention an strftime 
method for timedelta.



Regards,

Günther



More information about the Python-list mailing list