Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6680261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:27:16+00:00 2026-05-26T04:27:16+00:00

I need a stopwatch/timer to countdown. I’m trying to use Kellis Havers stopwatch jQuery

  • 0

I need a stopwatch/timer to countdown. I’m trying to use Kellis Havers stopwatch jQuery plugin and change it to countdown.

But can’t figure out how to make it substract instead of add seconds, tried changing the ‘second++;’ to ‘second–;’ but got this result= 00:03:0-1. It says in the comments that parseInt() is not working, so i figure it something with the seconds is written in 01 02 03 04 etc.

But I am not yet good enough to understand how to get it to countdown.

function do_time() {
            // parseInt() doesn't work here...
            hour = parseFloat(h.text());
            minute = parseFloat(m.text());
            second = parseFloat(s.text());

            second++;

            if(second > 59) {
                second = 0;
                minute = minute + 1;
            }
            if(minute > 59) {
                minute = 0;
                hour = hour + 1;
            }

            h.html("0".substring(hour >= 10) + hour);
            m.html("0".substring(minute >= 10) + minute);
            s.html("0".substring(second >= 10) + second);
        }
    }
})(jQuery);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:27:16+00:00Added an answer on May 26, 2026 at 4:27 am

    parseInt will work fine if you include 10 as a second argument.

    Change to:

            hour = parseInt(h.text(),10);
            minute = parseInt(m.text(),10);
            second = parseInt(s.text(),10);
    
            second--;
    
            if(second < 0) {
                second = 59;
                minute = minute - 1;
            }
    
            if(minute < 0) {
                minute = 59;
                hour = hour - 1;
            }
    
            h.html("0".substring(hour >= 10) + hour);
            m.html("0".substring(minute >= 10) + minute);
            s.html("0".substring(second >= 10) + second);
    

    jsFiddle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need shows the timer running in console. I use stopwatch: System.Diagnostics.Stopwatch stopwatch =
I want to use this stopwatch (or something similar): http://www.sivamdesign.com/scripts/dwld/stopwtch.txt but I will need
I am using the jQuery Stopwatch plugin to track time on a browser based
I need an accurate timer, and DateTime.Now seems not accurate enough. From the descriptions
I am trying to create an app in which, I need navigation bar button
How accurate is System.Diagnostics.Stopwatch ? I am trying to do some metrics for different
I'm trying to figure out the best way to convert a string containing a
i need to create stopwatch with start,stop and pause in android. please assist me.
I use some kind of stopwatch in my project and I have start time
I need to connect to a webservice from my iOS app however I can't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.