-3

I take the time now, and I need to know how many minutes left for the next multiple minute of 5, for example, I use the function now = datetime.now() and returns datetime.datetime(2019, 8, 2, 9, 33, 5, 478647), in this example, left 2 minutes for the 35 minutes, I need the program do that automatically.

guilherme
  • 35
  • 6

1 Answers1

1
time = datetime.datetime.now()
min = time.minute
left = 5-(min%5)

This will return 5 if the minute is a multiple of 5.

clubby789
  • 2,543
  • 4
  • 16
  • 32