-2

I can not do it in the form such that it has deducted the time from today to an example; 2021: 04: 05 in the form of hours: minutes: seconds

from datetime import datetime, time



leaving_date = datetime.strptime('2021-04-05 00:00:00', '%Y-%m-%d %H:%M:%S')
now = datetime.now()

print(str"%d hours, %d minutes, %d seconds")

Could someone improve my code and help me? thanks

1 Answers1

1

This will give you hours, minutes and seconds as a string each:

hours, minutes, seconds = str(now).split(" ")[1].split(".")[0].split(":")
BubbleMaster
  • 100
  • 6