Convert float to minute&seconds

Convert floats to integers?

Couldn’t you use Round or Floor ? That should get rid of the decimal part.

I am trying to convert a float (from a timer) to minutes and second (two separate float) and then put them back together with an Append strings node (append 6 to :slight_smile: and then (append 6: to 42) after converting both numbers to strings for example.

The only problem I am facing is that Im trying to get the amount of minutes and seconds without the comma and decimals.

To sum up, is there a way to only take the number before the decimals of a float?

Thanks for any help you can provide.

Now that I think of it, that should do the trick (I was thinking there could be trouble but since the float is set to second and not minutes it should be fine).

I know we can convert int to float, but I do not find the float to int.

float to string then string to int?

I was able to do it by converting it to an integer then a float (although your thing would have worked aswell). Then, I put branches to see if I could add one, two, three, etc. minutes to the timer. I attached my blueprint. Hope it can help others if they have the same issue. Now the timer shows as Minute: Seconds.

If you do a Floor on a float, the output is an int. That get’s read of the decimal part. Round can give you a bigger value if the decimal part is above 0.5f

To convert to a time format there is a BP node, but it sucks because miliseconds are not needed most of the time.
“Time Seconds to String” - Convert a number of seconds into minutes:seconds.milliseconds format string Target is Kismet String Library

I did my own using the FormatText BP node

1 Like