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
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!
There was a padZeroes option added in version 2.0.0: http://keith-wood.name/countdownRef.html#padZeroes
example:
$("#foo").countdown({
until: new Date(2014, 11-1, 14),
padZeroes: true
});
I added an issue to Countdown project to make new "leading zeros" option
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With