Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Displaying game time in (hrs:min:sec)

Posts: 235Member, PRO
I have an attribute that increases by one every second.

I found a tutorial which explains how to take this attribute and change it to a time format showing minutes and seconds in the display text expression editor e.g. 00:00

What I need to know is how to add hours as well e.g. 00:00:00

----------------------------------------
What I have working for min and sec is below:

floor(floor(( game.TotalTimeSpinning %3600)/60)/10)
..floor((floor( game.TotalTimeSpinning %3600)/60)%10)
..":"..
floor(( game.TotalTimeSpinning %60)/10)
..floor( game.TotalTimeSpinning %10)
-----------------------------------------

I know it's easy math but my brain is fried right now and I can't figure the equation to show the hours.
Any help would be appreciated.

• I am here.Posts: 6,577Member, Sous Chef, PRO

Hi,@jesse75, yup, I get fried brains too, especially at 1 in the morning... :-)

Here is the hrs:mins:secs as you want:

floor(( game.TotalTimeSpinning )/3600)..":"..floor(floor((( game.TotalTimeSpinning )%3600)/60)/10)..floor((floor(( game.TotalTimeSpinning )%3600)/60)%10)..":"..floor((( game.TotalTimeSpinning )%60)/10)..floor(( game.TotalTimeSpinning )%10)

""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

• Posts: 235Member, PRO
ahhh. Thank you!
• Posts: 48Member, PRO
edited May 2015

I know this is few months old but for anyone who wanted to have 00.00.00 format as oppose to 0.00.00 that is shown up there you can use the following:

for clarification, game.TotalTimeSpinning is the variable that keeps track of your time in seconds.

floor(floor((game.TotalTimeSpinning)/3600)/10)..floor((( game.TotalTimeSpinning )/3600)%10)..":"..floor(floor((( game.TotalTimeSpinning )%3600)/60)/10)..floor((floor(( game.TotalTimeSpinning )%3600)/60)%10)..":"..floor((( game.TotalTimeSpinning )%60)/10)..floor(( game.TotalTimeSpinning )%10)

I'm posting this as I wanted this myself and I figured some others might too.

• Posts: 10Member, PRO

thanks all this just saved me hours

• London, UK.Posts: 12,822Member
edited March 2016

@cao cao xgsx said:
thanks all this just saved me hours

You could also use the more simple: