Using the plugin to create countdowns with the format hh:mm:ss like the populars coupons sites.
Reset countdown to
.
<script type="text/javascript" charset="utf-8">
// Javascript
$(function() {
$('div#clock').countdown(new Date(2015, 6, 28), function(event) {
// Update every second one time only
if(event.type != "seconds") return;
// Calculate the time left
var timeLeft = [
event.lasting.hours + event.lasting.days * 24,
event.lasting.minutes,
event.lasting.seconds
];
// Convert the number to two digits strings
for(var i = 0; i < timeLeft.length; ++i) {
timeLeft[i] = (timeLeft[i] < 10 ? '0' : '') + timeLeft[i].toString();
}
// Concatenate the strings with : and update the html
$(this).html(timeLeft.join(':'));
});
});
</script>
<!-- HTML -->
<div id="clock"></div>