0

I am trying to use a TimeField model which only consists of MM:SS.xx (ie 43:31.75) format. Is it possible to format a regular Python time object like this?

Thanks.

1 Answers1

0

Absolutely, you can find it in the datetime module here.

http://docs.python.org/release/2.5.2/lib/datetime-time.html

>>> from datetime import time
>>> time_obj = time(0, 43, 31, 750000)
datetime.time(0, 43, 31, 750000)
>>> time_obj.strftime('%M:%S.%f')
'43:31.750000'
Bryan
  • 6,682
  • 2
  • 17
  • 21
  • Thank you, but what I am trying to express is like '43:31.75(43 minutes and 31.75 seconds)', just like long-distance running results,how can I make that format? – Tianyaa Lee May 19 '13 at 04:22