Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.