Skip to content

Instantly share code, notes, and snippets.

@jsrath
Last active Nov 8, 2018
Embed
What would you like to do?
if (timeRemaining >= 0) {
hours = parseInt(timeRemaining / 3600);
timeRemaining = timeRemaining % 3600;
minutes = parseInt(timeRemaining / 60);
timeRemaining = timeRemaining % 60;
seconds = parseInt(timeRemaining);
document.querySelector('#hours').innerHTML = ('0' + hours).slice(-2);
document.querySelector('#minutes').innerHTML = ('0' + minutes).slice(-2);
document.querySelector('#seconds').innerHTML = ('0' + seconds).slice(-2);
}
}
setInterval(calculate, 1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment