On 4 jun, 06:14, "Günther Dietrich" <gd.use...@spamfence.net> wrote: > GabrielGenellina<gagsl-...@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. You're right. Second try (still untested): def nice_timedelta_str(d): result = str(d) if result[1] == ':': result = '0' + result return result delta = now2-now1 print nice_timedelta_str(delta) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list