0

How do I format the output of date time.timedelta? I have the following code:

duration_epoch = issue['end'] - issue['start']

duration = timedelta(milliseconds=duration_epoch) 

print(str(duration))

This outputs in the format:

# 7 hours 41 minutes and 00 seconds
7:41:00

I want the output format to be:

0d 7h 41m 

Unfortunately When I try to use strftime, I get an error :

AttributeError: 'datetime.timedelta' object has no attribute 'strftime'
FObersteiner
  • 16,957
  • 5
  • 24
  • 56
Bruce Banner
  • 131
  • 7

0 Answers0