Skip to content

Instantly share code, notes, and snippets.

@httpsterio
Created May 4, 2017 10:45
Show Gist options
  • Select an option

  • Save httpsterio/eb3ffae2c1a69e059e20bb84d0de1b67 to your computer and use it in GitHub Desktop.

Select an option

Save httpsterio/eb3ffae2c1a69e059e20bb84d0de1b67 to your computer and use it in GitHub Desktop.
function initializeClock(id, endtime) {
var clock = document.getElementById(id);
var timeinterval = setInterval(function() {
var t = getTimeRemaining(endtime);
clock.innerHTML =
"days: " +
t.days +
"<br>" +
"hours: " +
t.hours +
"<br>" +
"minutes: " +
t.minutes +
"<br>" +
"seconds: " +
t.seconds;
if (t.total <= 0) {
clearInterval(timeinterval);
}
}, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment