Converting milliseconds to human time

Dan Bishop danb_83 at yahoo.com
Fri Jan 6 20:31:17 CET 2006


Harlin Seritt wrote:
> I would like to take milliseconds and convert it to a more
> human-readable format like:
>
> 4 days 20 hours 10 minutes 35 seconds
>
> Is there something in the time module that can do this? I havent been
> able to find anything that would do it.

The datetime module has something like that:

>>> d = datetime.timedelta(milliseconds=418235000)
>>> print d
4 days, 20:10:35




More information about the Python-list mailing list