How do I translate Float to hh:mm?

I can’t get it over my head on how to convert Float into hh:mm.
So the game has a day and night time. Ranging from 0 to 2400 in float.
0 - is 12am
400 - is 4am
650 - is 6:30am
and so on. The float resets to 0 after reaching 2400.

I’ve already made a widget that shows the hours by doing in-ranges[float], branches, division and addition.

There’s a variable type specifically for times, are you avoid that for some reason?

Are you using div and mod? ( / and % ), or truncate etc.

Use the timecode/timespan features. Trust me, I’ve tried to do what you are doing - using the timespan/timecode variables is the only sane way to work.

They seem a little weird at first but it saves you from having to do any conversions and once you understand the nodes it is dead easy to use.

From timespan you can just use “as timespan” and this autoconverts to string format.

I’m pretty new to this UE. By new, like… 2 days in. Here’s what I did.

I tried doing the Make Timespan. Connected the Time of Day to Make Timespan as shown in the link above. But the As Timespan shows it as 82:01:00 at 81 [Float] when I connect it to the text variable. If you guys can supply images on how it’s done. I would greatly appreciate it.

I apologize, there is in fact one conversion you will need to make. Just opened up my project to see how I had done it.

This converts the float time to a time code, and then from there you can make full use of timecode/timespan.

Note that this function I took from the Ultra Dynamic Sky asset from marketplace.

Okay, I got it working as I wanted it to be. But in a roundabout way. Using truncated instead of Timespan. Timespan works but I want the seconds excluded.

I appreciate the help guys.

1 Like

You could also try this node:

But rather than 0 → 2400, it would be 0 → 1440 because of how % workS… or keep 0 → 2400 and do Remainder * 0.01 * 60 to get 0 → 60 seconds from 0 → 100 range.

You can use the condition < 2400 / 2 = AM, else its PM if you are not doing 24h clock.

Combined with this for the ##:## format: