Extracting time from a timedelta

0 votes
How can I get time from a datetime.timedelta object in Python?
Aug 13, 2019 in Python by Fata
• 1,050 points
28 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, 2019 by Wajiha
• 1,950 points