How would I display a number as time?

My question is:
How would I make a number displayed as time
For instance:
100 = 1:40
180 = 3:00
600 = 10:00
How would I do this?


Please look this up before you make this, also wrong category. Anyways:

function toMS(seconds)
	return string.format("%02i:%02i", seconds/60%60, seconds%60)
1 Like

What category would I put this in? I am new so I have no idea where I should put it

Help And Feedback, Scripting Support

1 Like

Also, I edited my script cause there was a typo, also if you’d like to add hours too it aswell then you could do this:

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

Just a note you put to comas here.
Just wanted to point it out

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.