0

Can some one help me with an hour to minute converter

The current time is 10:30 PM and I need to set an alarm clock at 6:00 AM, I have to set the timer in minutes though. I have made the script extremely simple, but I feel like there could be a better way to make it? https://code.sololearn.com/c8pNchwp6Xla/?ref=app

28th Jan 2019, 4:01 PM
Ivan
1 Antwort
+ 1
I would try this: How many minutes to you need to get the next full hour? (60 - minutes of current time) In your case 30 minutes. (11:00) How many hours from 11 to 6 (12 - hour of new current time + hour of alarm clock) --> 7 (because its p.m.) 7*60 + 30 = 450
28th Jan 2019, 5:04 PM
Denise Roßberg
Denise Roßberg - avatar