tags:

views:

837

answers:

4

Hello, I'm using a JQuery Countdown Clock plugin from here.

Unfortunately I need to have leading 0 where there are single digits. For example 1:1:22 should display as 01:01:22.

Can anyone help with this?

Thanks

+1  A: 

I added an issue to Countdown project to make new "leading zeros" option

Mihailoff
A: 

Checkout the "formats 1" section. The "Compact" format shows the leading zeros.

their example:

$('#compact').countdown({until: liftoffTime, compact: true, 
description: ''});
+2  A: 

I got this working using the 'Layout' mode.

http://keith-wood.name/countdownRef.html

My code now looks like this...

     $j('#Countdown').countdown({
      until: until,
      layout: '<div class="countdown_section">' +
   '<div><span class="digits">{dnn}</span><br/>Days</div>' +
   '<div><span class="digits">{hnn}</span><br/>Hours</div>' +
   '<div><span class="digits">{mnn}</span><br/>Minutes</div>' +
   '<div><span class="digits">{snn}</span><br/>Seconds</div></div>',
      serverTime: since,
      onExpiry: function(){
       render_expire();
      }
     });

Cheers!

Martin
amazing, thanks!
m4olivei
+1  A: 

I couldn't get that layout mode trick working, so I used this:

http://www.fundp.ac.be/sciences/chimie/javas/js_format.html

and spliced the code into the _showFull method in the countdown js file.

Martin Burke