Log in

View Full Version : Dynamic Countup Script - Number Formatting



zero002021
11-25-2008, 08:18 PM
1) Script Title: Dynamic Countup Script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex6/countingup.htm

3) Describe problem: I am trying to customize the Dynamic Countup Script so that it displays double-digits at all times. For example, instead of "0 days, 0 hours, 0 minutes, 0 seconds", I want it to show "00 days, 00 hours, 00 minutes, 00 seconds". Here is what I have so far: http://beabigfish.com/dev/countup/. Any help is appreciated.

ddadmin
11-26-2008, 07:04 AM
Try finding the below line inside the script:


var result={days: dayfield, hours:hourfield, minutes:minutefield, seconds:secondfield}

and replace that with:


var result={days: (dayfield<=9? "0" : "")+dayfield, hours:(hourfield<=9? "0" : "")+hourfield, minutes:(minutefield<=9? "0" : "")+minutefield, seconds:(secondfield<=9? "0" : "")+secondfield}