0

I'm trying to create a script that will print the amount of time left till I have to do a certain task.

e.g.

Biology class in 34 minutes. 

I've tried

datetime.time(20, 30) - datetime.datetime.now()

but that doesn't work. I'm not sure how to incorporate time in hours and seconds instead of days and years.

n0x
  • 17
  • 5
  • 1
    Please explain what "that doesn't work" means. – Scott Hunter Dec 11 '20 at 16:58
  • TypeError: unsupported operand type(s) for -: 'datetime.time' and 'datetime.datetime' my apologies – n0x Dec 11 '20 at 17:01
  • Does this answer your question? [How do I find the time difference between two datetime objects in python?](https://stackoverflow.com/questions/1345827/how-do-i-find-the-time-difference-between-two-datetime-objects-in-python) – FObersteiner Dec 11 '20 at 17:15

0 Answers0