Gayner Posted September 6, 2009 Share Posted September 6, 2009 function countdown(Time_Left) { Today = new Date(); if(Time_Left < 0) Time_Left = 0; time_left2=Time_Left; days = Math.floor(Time_Left / (60 * 60 * 24)); Time_Left %= (60 * 60 * 24); hours = Math.floor(Time_Left / (60 * 60)); Time_Left %= (60 * 60); minutes = Math.floor(Time_Left / 60); Time_Left %= 60; seconds = Time_Left; dps = 's'; hps = 's'; mps = 's'; sps = 's'; //ps is short for plural suffix. if(days == 1) dps =''; if(hours == 1) hps =''; if(minutes == 1) mps =''; if(seconds == 1) sps =''; document.getElementById("countdown").innerHTML = days + ' day' + dps + ' '; document.getElementById("countdown").innerHTML += hours + ' hr' + hps + ' '; document.getElementById("countdown").innerHTML += minutes + ' min' + mps + ' and '; document.getElementById("countdown").innerHTML += seconds + ' sec' + sps; //Recursive call, keeps the clock ticking. time_left2--; setTimeout('countdown('+time_left2+');', 1000); } I only want it to countdown each 1hour only, not days? Help ? Thx Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted September 6, 2009 Share Posted September 6, 2009 If you're using the Date object why don't you use the getHours() method? Quote Link to comment Share on other sites More sharing options...
Gayner Posted September 6, 2009 Author Share Posted September 6, 2009 If you're using the Date object why don't you use the getHours() method? It's part of a lottery script That's why Anyway Is there anyway If I remove the * 24 it will work? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.