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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:54:35+00:00 2026-06-11T02:54:35+00:00

I have a countdown timer with days, hours, minutes and seconds. I want to

  • 0

I have a countdown timer with days, hours, minutes and seconds. I want to remove days. Need to convert days to hours.

I tried to do it by myself, but no success because of lack of knowledge.

    (function(){
    $.fn.lofCountDown = function( options ) {
        return this.each(function() { 
            // get instance of the lofCountDown.
            new  $.lofCountDown( this, options ); 
        });
     }
    $.lofCountDown = function( obj, options ){
        this.options = $.extend({
                autoStart           : true,
                LeadingZero:true,
                DisplayFormat:"<div>%%D%% Days</div><div>%%H%% Hours</div><div>%%M%% Minutes</div><div>%%S%% Seconds</div>",
                FinishMessage:"Expired",
                CountActive:true,
                TargetDate:null
        }, options || {} );
        if( this.options.TargetDate == null || this.options.TargetDate == '' ){
            return ;
        }
        this.timer  = null;
        this.element = obj;
        this.CountStepper = -1;
        this.CountStepper = Math.ceil(this.CountStepper);
        this.SetTimeOutPeriod = (Math.abs(this.CountStepper)-1)*1000 + 990;
        var dthen = new Date(this.options.TargetDate);
        var dnow = new Date();
        if( this.CountStepper > 0 ) {
            ddiff = new Date(dnow-dthen);
        }
        else {
             ddiff = new Date(dthen-dnow);
        }
        gsecs = Math.floor(ddiff.valueOf()/1000); 
        this.CountBack(gsecs, this);
    };
     $.lofCountDown.fn =  $.lofCountDown.prototype;
     $.lofCountDown.fn.extend =  $.lofCountDown.extend = $.extend;
     $.lofCountDown.fn.extend({
        calculateDate:function( secs, num1, num2 ){
              var s = ((Math.floor(secs/num1))%num2).toString();
              if ( this.options.LeadingZero && s.length < 2) {
                    s = "0" + s;
              }
              return "<b>" + s + "</b>";
        },
        CountBack:function( secs, self ){
             if (secs < 0) {
                self.element.innerHTML = '<div class="lof-labelexpired"> '+self.options.FinishMessage+"</div>";
                return;
              }
              clearInterval(self.timer);
              DisplayStr = self.options.DisplayFormat.replace(/%%D%%/g, self.calculateDate( secs,86400,100000) );
              DisplayStr = DisplayStr.replace(/%%H%%/g, self.calculateDate(secs,3600,24));
              DisplayStr = DisplayStr.replace(/%%M%%/g, self.calculateDate(secs,60,60));
              DisplayStr = DisplayStr.replace(/%%S%%/g, self.calculateDate(secs,1,60));
              self.element.innerHTML = DisplayStr;
              if (self.options.CountActive) {
                   self.timer = null;
                 self.timer =  setTimeout( function(){
                    self.CountBack((secs+self.CountStepper),self);          
                },( self.SetTimeOutPeriod ) );
             }
        }           
    })
})(jQuery)

Thanks

  • 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-11T02:54:37+00:00Added an answer on June 11, 2026 at 2:54 am

    Change the line that says:

    DisplayFormat:"<div>%%D%% Days</div><div>%%H%% Hours</div><div>%%M%% Minutes</div><div>%%S%% Seconds</div>",
    

    To read:

    DisplayFormat:"<div>%%H%% Hours</div><div>%%M%% Minutes</div><div>%%S%% Seconds</div>",
    

    Then change the line that says:

    DisplayStr = DisplayStr.replace(/%%H%%/g, self.calculateDate(secs,3600,24));
    

    To read:

    DisplayStr = DisplayStr.replace(/%%H%%/g, self.calculateDate(secs,3600,876581));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create a countdown clock, that counts down the days, hours, minutes
I have a countdown timer that onFinished I want to have the screen change
I have a countdown timer that displays the number of seconds left on a
I have a this working countdown timer in jQuery but for now I'm just
I have tried to create countdown timer from database. I have sent deltaTimeServer to
I have a countdown timer and a responsive wallpaper. Now what I want to
I have created an application.in the app i start a countdown timer and save
I have the following script: Timer=0; function countdown(auctionid){ var auctions; var divs; Timer=Timer+1; if((Timer%10==0)||(Timer==1)){
I write a countdown timer in jQuery and i need to keep some datas
I have an app that runs a countdown timer and brings up an alertbox

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.