Help with my timer

I am trying to make a countdown timer with a 00:00:00:00 format, but when a number is less than 10, it gets offcentered. Here is a picture:


So basically, I want to know how to add a “0” before a number if it’s less than 10, so it will stay centered? Ive tried everything I can think of, but I cant do it. Here is a picture of the base code. I had to get help from someone else so I don’t actually know javascript, so please keep that in mind!


Please help if you can!

Javascript (and most languages) treat numbers as numbers. Meaning that preceeding 0s are not kept on whole numbers.

I think you need to basically not treat it as numbers, but text.

So you’d store each value in a variable (such as “HourNum” for hours), then convert it to a string variable (e.g. “HourText”), then a separate event with a condition of Compare Two Numbers, with “StrLength(HourText) = 1” as a condition, and then an action to create a final string variable (“HourFinal”) which is “Set string of “HourFinal”: “0” + VariableString(HourNum)”

You’d have another variable that is “StrLength(HourText) > 1” as a condition, which just sets HourFinal to VariableString(HourNum).