Created
March 14, 2011 15:35
-
-
Save thurloat/869322 to your computer and use it in GitHub Desktop.
Round minutes from midnight to the next 5 minute increment.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var right_now = new Date(); | |
var raw_minutes = right_now.getHours() * 60 + right_now.getMinutes(); | |
while (raw_minutes % 5 > 0){ | |
raw_minutes += 1; | |
} |
Your submission has been accepted ;)
-- Thanks Sam
You are most welcome :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello Thurloat,
IMHO, I think (raw_minutes % 5) is more efficient that the string casting and the index of stuff.
Just a thought :)