Is there a way to convert seconds into minutes & seconds?

For example, I want my game to have a game clock like in basketball or football where you’d see the minutes and seconds left in the game…I don’t want a timer that displays just seconds. Is there a way to convert seconds into a minute:seconds display?

Are you looking for built-in functions? Because it’s pretty simple math:

int32 minutes = totalSeconds / 60;
int32 seconds = totalSeconds % 60;

Yeah I’m looking for built in functions…something that’s an accessible node in the blueprint graphs

You have % (mod) and division / nodes in blueprints so you can easily do that. There’s no built in node like that already, it’s too specific to be of any use, but you can create a macro or function node yourself for reuse.

You can build it yourself. The only tricky part is for it to display 12 min 7 sec as 12:07, instead of 12:7 because you cannot add a zero in front of an integer.

For that you can convert the integer to string & add a ‘0’ in front if the value is 9 or below.

Best way is to make a macro and then call it in the event graph.



Setup is similar to what I have, expect I use Rama’s Combine string function node.

Wanted to say after I looked high and low, I found soulmapp’s method works. I set a timer in my Gamestate and for this widget I call the timer here. I made a slight adjustment to soulmapp’s answer so the timer displays seconds as a double digit number such as 9:08 (9min 8sec) rather than 9:8.


Thank you very much, soulmapp!