Jump to content

Help me convert this script to only read 1hour..


Gayner

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.