What ways are there to display 00:00:00:00 timer?

What ways are there to display like the said timer, For example you have 7 minutes but you convert it to this type of time to get 00:07:00:00

It goes by: Hours,Minutes,Seconds,Miliseconds

im not sure at all but i think os.clock() does something like this

You could use string.format("%02i", number) to convert Do this. and you can use the module (%) to get the remainder.

here is a sample code of how you might want it.

string.format("%02i:%02i:%02i", (seconds/60^2)%60, (seconds/60)%60, seconds%60)
1 Like

Are you trying to use this for a live countdown?

No it’s just a countdown that’ll happen each time someone pressed a buttton

Sorry, made a mistake on the last post.
You can use repeat until, and use tostring() to get the text/timer countdown.

A quick function which takes seconds as an argument and converts it into the format: 00:00:00.

local function displayTimer(s)
     return string.format("%02i:%02i:%02i", (seconds/60^2)%60, (seconds/60)%60, seconds%60)

displayTimer(600) --> 10 minutes
1 Like