Stopwatch - adding leading zeros to H,M,S times

The Chrono function uses #SWEH# #SWEM# #SWES# for Hours, Minutes and Seconds in the timer display. Is there a way to add leading zeros so you get a “00:00:00” kind of display?

The function I want to add this to is shown below (unless there is a better way of doing this):
(floor(#SWEH#%60)):(floor(#SWEM#%60)):(floor(#SWES#%60))

Any suggestions would be greatly appreciated.

$(floor(#SWES#%60))>9?(floor(#SWES#%60)):0(floor(#SWES#%60))$

2 Likes

Sorry, but I plugged that in and it didn’t work. Did you try it out at your end and got it to work?


You have to click in the middle of a watch face to start the chronometer.

1 Like

You have duplicated the post, perhaps it is better to remove it.

1 Like

Thank you very much for trying to help with this, but you can see from your own screenshot that this isn’t working. It should be displaying “00:00:00” on the watch face, and then when you start the chrono. the timer would start showing elapsed time.

You can also see that your formula gets to 60 seconds and then just restarts at zero. My post requested an H:M:S timer and not just seconds.

I think I see now that if I string the formulas together using H and then M and then S using your formula it should work. Something like this:
$(floor(#SWEH#%60))>9?(floor(#SWEH#%60)):0(floor(#SWEH#%60))$:$(floor(#SWEM#%60))>9?(floor(#SWEM#%60)):0(floor(#SWEM#%60))$:$(floor(#SWES#%60))>9?(floor(#SWES#%60)):0(floor(#SWES#%60))$

I’ll try that out.

Nope. That didn’t work. I’m new to using this kind of coding and don’t know how to string the expressions together

Are you sure this is not working? Then look at the corrected watch face upstairs. For some reason, I thought that you would have done the rest by yourself :slightly_smiling_face:

1 Like

I had a “duh” moment in not figuring this out. I just placed three separate elements, one with #SWEH#, one with #SWEM# and one with #SWES#, each separated by a colon and it worked fine.

Thank you very much for helping me solve this.

1 Like

I’ve only been using Facer Creator Pro for three days, but soon hit the same problem of no leading zeroes in the standard #SWEH# #SWEM# #SWES# coding for a stopwatch digital timer. When I first read this thread, I didn’t pick up exactly what Richard meant by ‘separate elements’ in his last post.

Just in case any other confused newbie visits this thread, what Richard meant was that you need to add three separate Digital Timer elements to the watch face. In my case, I also wanted milliseconds, so I added four Digital Timer elements, with coding as shown below.

Note that I removed the Modulo operator from the Hour timer, as I don’t think it performs a useful purpose and I assume it would generate the wrong value when it runs over 60 hours. Please correct me if I am wrong in this assumption!!

Hours Dig Timer: $(floor(#SWEH#))>9?(floor(#SWEH#)):0(floor(#SWEH#))$:

Mins Dig Timer: $(floor(#SWEM#%60))>9?(floor(#SWEM#%60)):0(floor(#SWEM#%60))$:

Secs Dig Timer: $(floor(#SWES#%60))>9?(floor(#SWES#%60)):0(floor(#SWES#%60))$:

Millisecs Dig Timer: $(floor(#SWEMS#%60))>9?(floor(#SWEMS#%60)):0(floor(#SWEMS#%60))$

1 Like

Hi David,

so sorry to disturb you but I would like to add something like this to a face…

HH:MM:SS.MMM

I want the face to show something like:

01:01:01.001 (leading zeros all the way to the milliseconds)

I tried to use your code/formulas but I cannot get what I want, can you help me please? Thank you in advance.

Best regards,

Mau

Hi, meanwhile there were added text functions for adding leading zeros and to set decimal numbers.
Try this, I guess you can derive from that how to add the hours yourself
(pad((floor(#SWEM#%60)),2)):(pad(floor(#SWES#%60),2)).(pad(toFixed(#SWES#%1,3),3))

1 Like

Dear petruuccios,

thank you for your prompt answer, unfortunately it didn’t work (I am attaching a screenshot). The time is still showing a space when it should be showing a leading zero.

Best regards,

Mau

If you added inspectable draft, we could look for mistakes.
This:
(pad(floor(#SWEH#),2)):(pad((floor(#SWEM#%60)),2)):(pad(floor(#SWES#%60),2)).(pad(toFixed(#SWES#%1,3),3))
should look like this:
image

1 Like

Book Marked Master Class Thank you Peter . Facer University Stuff as Always . I find a Millisecond really useful on a Watch Face . :rofl: . I often wonder what the tolerance on a Button Push is . I know my reaction time is 250MS +/- 50 . When we were doing Timed effects in front of High speed Cameras we worked to 1/100 but practically 1/10 second . Our equipment offered tolerances of about 1/25 second .

Intersting!
I find the 3 digit miliseconds slightly confusing and use:

(pad((floor(#SWEMS#/10)%100),2))

1 Like

I find 3 decimal places visually interesting, but technically more optimistic than trustworthy, so I use no more than 2 too.
image

But here it was requested namely like that:

2 Likes