How to convert Game time Format to 00:00:00
Anyone have an idea how to set the gametime to a 00:00:00 format Basically i want it to be 00:01:08 indicating 1 minute 8 seconds.
Right now it outputs as 1.8 I tried various ways of doing this but none of them does what i want. The only solution i do have is a very long a tedious and unpractical way of comparing every second.
Compare INT if equal to 1 set String to 01, If INT 2 Set String to 02 etc.
Im sure there is an easier way. Just haven't found it yet.
My HUD is configured to print it correctly. I just need the correct format
asked Aug 01 '14 at 08:40 AM in Using UE4
You can get the seconds by using Modulo. In code you would use the % sign.
The way it works is it will remove 60 (or whatever you use) from GameTimeInSeconds until there's less then 60 left. It will then return whatever is left. In this case you remove one minute at a time until there's less then a minute left, and the result is the remaining seconds.
You get the minutes by dividing by 60 and flooring the value. You get the hours by dividing by (60*60) which is 3600, and flooring the value. You can get days by dividing by (60*60*24) and flooring the value.
answered Aug 01 '14 at 09:01 AM
Stumbled across your post while I was trying to do something similar. I figured out a great way to do it that doesn't require a lot of effort! :)
answered Apr 04 '17 at 01:40 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here