Skip to content

Instantly share code, notes, and snippets.

@cbmeeks
Created December 20, 2016 15:23
Show Gist options
  • Save cbmeeks/c7686df9d72eb10124e392217dca5b1d to your computer and use it in GitHub Desktop.
Save cbmeeks/c7686df9d72eb10124e392217dca5b1d to your computer and use it in GitHub Desktop.
Times in 15 minute increments for the day
var times = [];
for(var hour = 0; hour < 24; hour++) {
for(var mins = 0; mins < 60; mins = mins + 15) {
var m = "0" + mins;
if (hour < 12)
times.push( (hour === 0 ? 12 : hour) + ":" + (m.substr(1, 2) === "0" ? "00" : m.substr(1, 2)) + " AM");
else
times.push( ((hour - 12) === 0 ? 12 : hour - 12) + ":" + (m.substr(1, 2) === "0" ? "00" : m.substr(1, 2)) + " PM");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment