How many seconds till tomorrow?
To get the number of milliseconds till tomorrow, we can from “tomorrow 00:00:00” substract the current date.
First, we generate that “tomorrow”, and then do it:
Please note that many countries have Daylight Savings Time (DST), so there may be days with 23 or 25 hours. We may want to treat such days separately.
Create a function
getSecondsToTomorrow() that returns the number of seconds till tomorrow.
For instance, if now is
getSecondsToTomorrow() == 3600
P.S. The function should work at any day, the “today” is not hardcoded.