David542
David542

Reputation: 110482

Get time object from milliseconds

What would be the best way to get a python time object form milliseconds int? For example:

ms = 2588832
datetime.timedelta(seconds = ?)

The answer I want to get is "00:43:08"

Upvotes: 2

Views: 169

Answers (1)

Kevin
Kevin

Reputation: 30171

You can create timedeltas directly from milliseconds:

datetime.timedelta(milliseconds=2588832)

Upvotes: 4

Related Questions