Home
Products
Community
Manuals
Contact
Login or Signup

converting seconds

BlitzPlus Forums/BlitzPlus Programming/converting seconds

gellyware(Posted 1+ years ago) #1
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?


WendellM(Posted 1+ years ago) #2
Hours = CurrentSeconds / 3600
Minutes = ( CurrentSeconds - ( Hours * 3600 ) ) / 60
Seconds = CurrentSeconds - ( Hours * 3600 ) - ( Minutes * 60 )


Space_guy(Posted 1+ years ago) #3
Thanks :) i needed this last night but got too lazy to figgure out the maths that moment.


gellyware(Posted 1+ years ago) #4
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"