Extracting time from a timedelta

0 votes
How can I get time from a datetime.timedelta object in Python?
Aug 13 in Python by Fata
• 1,040 points
11 views

1 answer to this question.

0 votes

Use the following piece of code:

import datetime
a = datetime.timedelta(0, 3600)
print((datetime.datetime.min + a).time())

OUTPUT:

01:00:00
answered Aug 13 by Wajiha
• 1,920 points