I want to show just the hours minutes and seconds calculated from days. I dont want to show days. how can I do this. I am using this below countdown library
http://www.gieson.com/Library/projects/utilities/countdown/
what I have tried so far is this
var myCountdownTest = new Countdown({
time:86400 * 60,
width : 300,
height : 70,
rangeHi:"hour",
style: "flip"
});
</script>
It is showing me HOURS MINUTES and SECONDS but according to the date.means If the time remaing is 2 days and 5 hours. It is showing me only 5 hour
Please help me thanks
Try this:
var end = new Date('02/19/2012 10:1 AM');
var _second = 1000;
var _minute = _second * 60;
var _hour = _minute * 60;
var _day = _hour * 24;
var timer;
function showRemaining() {
var now = new Date();
var distance = end - now;
if (distance < 0) {
clearInterval(timer);
document.getElementById('countdown').innerHTML = 'EXPIRED!';
return;
}
var days = Math.floor(distance / _day);
var hours = Math.floor((distance % _day) / _hour);
var minutes = Math.floor((distance % _hour) / _minute);
var seconds = Math.floor((distance % _minute) / _second);
document.getElementById('countdown').innerHTML = days + 'days ';
document.getElementById('countdown').innerHTML += hours + 'hrs ';
document.getElementById('countdown').innerHTML += minutes + 'mins ';
document.getElementById('countdown').innerHTML += seconds + 'secs';
}
timer = setInterval(showRemaining, 1000);