Display an in-game variable as HH:MM (not system time)

Happy Halloween everyone.

I've attached a screenshot of a HUD I made with HUD Maker Ultra and the in-game evented time system. The problem is immediately obvious: the minute variable text display isn't including 0 before single digits. This problem would still be an issue in RMMZ with no plugins available if displaying the minute variable in any other message window.

The time is supposed to be Military Time so modifying the text code to display the hour variable at the same time is optional.
The time is just tracked in-game by # of frames passing per some simple evented code and is going to be adjusted up or down later to design simple game balance concepts around the total number of frames passing in a 'day' to determine how quickly a day passes. This does not have to be precise since sleeping generally sets the time back to 6 AM in-game.

I skimmed the text codes for RMMZ and the Visustella Message Core and did not find anything to solve the problem.

Is there a text code or javascript line that would change the display specifically from '6' to '06' in an array for any value of 'minutes' from 0 to 9? Or do I need to run a conditional thread to intentionally set that value in parallel to those value(s) and allow them to increment normally, then set it to '10' at 10 minutes?

This is purely cosmetic prototyping at this stage, but Google kept yielding JavaScript threads trying to track system times or other things more complex than what I'm trying to tweak here.
Happy Halloween everyone.

I've attached a screenshot of a HUD I made with HUD Maker Ultra and the in-game evented time system. The problem is immediately obvious: the minute variable text display isn't including 0 before single digits. This problem would still be an issue in RMMZ with no plugins available if displaying the minute variable in any other message window.

The time is supposed to be Military Time so modifying the text code to display the hour variable at the same time is optional.
The time is just tracked in-game by # of frames passing per some simple evented code and is going to be adjusted up or down later to design simple game balance concepts around the total number of frames passing in a 'day' to determine how quickly a day passes. This does not have to be precise since sleeping generally sets the time back to 6 AM in-game.

I skimmed the text codes for RMMZ and the Visustella Message Core and did not find anything to solve the problem.

Is there a text code or javascript line that would change the display specifically from '6' to '06' in an array for any value of 'minutes' from 0 to 9? Or do I need to run a conditional thread to intentionally set that value in parallel to those value(s) and allow them to increment normally, then set it to '10' at 10 minutes?

This is purely cosmetic prototyping at this stage, but Google kept yielding JavaScript threads trying to track system times or other things more complex than what I'm trying to tweak here.
[string].padZero(number of digits)
[string].padZero(number of digits)
I think this is close but forgive my newness to JavaScript (I picked up just enough to read it but not enough to implement it recently)

There's a few options in HUD Maker Ultra: show text, show a variable, or return the result of JavaScript code.

I put a whole screenshot here but I assume I need a string showing the variable #6 (for tracking in-game minutes) and then the line here will pad a zero when there's only one digit?

Just making sure I understand what I need to test here, but thanks for your time regardless!
I think this is close but forgive my newness to JavaScript (I picked up just enough to read it but not enough to implement it recently)

There's a few options in HUD Maker Ultra: show text, show a variable, or return the result of JavaScript code.

I put a whole screenshot here but I assume I need a string showing the variable #6 (for tracking in-game minutes) and then the line here will pad a zero when there's only one digit?

Just making sure I understand what I need to test here, but thanks for your time regardless!
So you'd use the javascript option since just showing a variable isn't going to do what you want, and in the input box you'd do

return $gameVariables.value(6).padZero(2);
So you'd use the javascript option since just showing a variable isn't going to do what you want, and in the input box you'd do

return $gameVariables.value(6).padZero(2);
This worked perfectly, thanks! It wasn't directly related to HUD Maker Ultra but I'll try to tag this post appropriately.
I'll try to tag this post appropriately.
Just for the sake of your efforts, I don't know that tags do anything. I don't think anyone particularly looks at them (I know I look at the thread title and read the actual post), and they don't seem to accomplish much for searches.
Just for the sake of your efforts, I don't know that tags do anything. I don't think anyone particularly looks at them (I know I look at the thread title and read the actual post), and they don't seem to accomplish much for searches.
I'll keep this in mind. I was hoping the searches helped with internal forum searches and web crawling as well as you more experienced engineers in the community here.
They might? If you click on one, it pulls up a search for other posts with that tag...but, as always, the flaw with a tag-based system is it depends on other people typing the exact same thing for their tags.

I'm not saying don't use them if you want to, but I always just Google stuff and get results from the forums right away.

Original thread: https://forums.rpgmakerweb.com/threads/display-an-in-game-variable-as-hh-mm-not-system-time.162564/