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 8325093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:19:01+00:00 2026-06-09T00:19:01+00:00

I have created a custom Jquery Timer. but i am facing little problem i

  • 0

I have created a custom Jquery Timer. but i am facing little problem i dont know that is not working for me. below is my code.

  function show(Hos, mins, secds) {

        var hours = Hos;
        var minutes = mins;
        var seconds = secds;
        var dn = "AM";
        if (hours > 12) {
            dn = "PM"
            hours = hours - 12
        }
                    if (hours == 0)
                        hours = 12

        document.getElementById('<%= Label1.ClientID %>').innerHTML = hours + ":" + minutes + ":" + seconds + " " + dn
        if (parseInt(seconds) == 59) {
            seconds = 0;
            if (parseInt(minutes) == 59) {
                if (parseInt(hours) == 12) {
                    hours = 0;
                } else {
                    hours = parseInt(hours) + 1;
                }
            } else {

                minutes = parseInt(minutes) + 1;
            }
        } else {
            seconds = parseInt(seconds) + 1;

        }


        setTimeout("show('" + hours + "','" + minutes + "','" + seconds + "'" + " )", 1000)
    }

This code is working fine i am passing the hours,mins,seconds first time from the code behind using c#.Now my problem is i want to add “0” if the seconds is less than 9 and minutes less than 9 and hours less than 9. i have tried the following trick but i dont know why its not working for me..

if (seconds <= 9) {
                seconds = '0' + parseInt(seconds);
            }

Please help me..Actually what happens when i tried this . its concatenate 0 with seconds upto 9 but as 9 comes it restarts from 1. That is the problem.

  • 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-06-09T00:19:03+00:00Added an answer on June 9, 2026 at 12:19 am

    i have resolve this problem using some trick that is as follow:

    function show(Hos, mins, secds) {
    
            var hours = Hos;
            var minutes = mins;
            var seconds = parseInt(secds, 10);
    
    
            if (hours == 0)
                hours = 12
    
            if (parseInt(seconds, 10) < 10) {
                seconds = "0" + parseInt(seconds, 10);
            }
            if (parseInt(hours, 10) < 10) {
                hours= "0" + parseInt(hours, 10);
            }
            if (parseInt(minutes, 10) < 10) {
                minutes= "0" + parseInt(minutes, 10);
            }
            document.getElementById('<%= Label1.ClientID %>').innerHTML = hours + ":" + minutes + ":" + seconds + " "
            if (parseInt(seconds) == 59) {
                seconds = 0;
                if (parseInt(minutes, 10) == 59) {
                    if (parseInt(hours, 10) == 24) {
                        hours = 0;
                    } else {
                        hours = parseInt(hours, 10) + 1;
                    }
                } else {
    
                    minutes = parseInt(minutes, 10) + 1;
                }
            } else {
                   seconds = parseInt(seconds, 10) + 1;
           }
            setTimeout("show('" + hours + "','" + minutes + "','" + seconds + "'" + " )", 1000)
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with jQuery 1.7.2. I have create a custom plug-in that loads
I have created a custom jQuery plugin that does some simple image resizing for
I have created custom jQuery UI widget called uiPopover, very similar to UI-dialog (in
I have created a custom method that will return unique items, together with the
I have created a custom control but I can't bind a property to the
I have created a custom validator deriving from ValidationAttribute. My undertsandng is that it
I have created a series of custom jQuery events for use in mobile web
I have created a custom jQuery UI theme. One of my styles .ui-state-hover takes
I have a custom gallery plugin that I have created and I am wanting
So I don't have that much experience with js or jquery and I'm working

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.