On 3 jun, 17:24, dave <davidrey...@gmail.com> wrote: > Quick question. I have to time stamps (now and now2). > > now = datetime.datetime.now(); > now2 = datetime.datetime.now(); > > now2-now1 yields me a result in 0:00:00.11221 (H:MM:SS.ssss) > > I wanted to know if there is a standard python method or a quick hack > to add an extra zero in the beginning. > > So the result I am looking for would be 00:00:00.11221
Try the strptime method with a suitable format, like this (untested): delta = now2-now1 delta.strftime('%H:%M:%S.%f') http://docs.python.org/library/datetime.html#strftime-strptime-behavior -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list