Created
February 2, 2011 20:56
-
-
Save Zettt/808416 to your computer and use it in GitHub Desktop.
Short TextExpander snippet to round the current time to a quarter hour.
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
set currentHour to hours of (current date) | |
set currentMinute to minutes of (current date) | |
if (currentMinute ≥ 0) and (currentMinute ≤ 7) then | |
set currentMinute to "00" | |
else if (currentMinute > 7) and (currentMinute ≤ 23) then | |
set currentMinute to "15" | |
else if (currentMinute > 23) and (currentMinute ≤ 37) then | |
set currentMinute to "30" | |
else if (currentMinute > 37) and (currentMinute ≤ 52) then | |
set currentMinute to "45" | |
else if (currentMinute > 52) then | |
set currentMinute to "00" | |
set currentHour to currentHour + 1 | |
else | |
return "Error" | |
end if | |
return (currentHour as string) & ":" & (currentMinute as string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment