converting seconds
BlitzPlus Forums/BlitzPlus Programming/converting seconds
| ||
I am making a count down timer, the starting time is 18000 seconds, how can i convert this to hours, minutes, seconds? currentSeconds/3600 gives me the hours. But, currentSeconds/hours/60 gives me 74, which obviously isnt the proper minutes, any suggestions? |
| ||
Hours = CurrentSeconds / 3600 Minutes = ( CurrentSeconds - ( Hours * 3600 ) ) / 60 Seconds = CurrentSeconds - ( Hours * 3600 ) - ( Minutes * 60 ) |
| ||
Thanks :) i needed this last night but got too lazy to figgure out the maths that moment. |
| ||
Thanks Wendell, I ended up getting this working before seeing your post, not sure exactly how this works, but I stumbled across it somehow: curTick = TimerTicks (millitime) If curTick >= newTick newTick = TimerTicks (milliTime)+1 timeSec = timeOriginal - curTick timeHour = timeSec/3600 timeMin = (timeSec/60) Mod 60 timeSec = timeSec Mod 60 EndIf timeStatus$ = timeHour+"Hours, "+timeMin+"Minutes, "+timeSec+" seconds remaining" |