News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.


Post Reply  Post Thread 
converting seconds to %H:%M:%S
Author Message
mikshaw
Senior Member
****


Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
RE: converting seconds to %H:%M:%S

Apparently the os.date() function doesn't do what I thought it did. I found this function posted on a message board:

Code:
function SecondsToClock(sSeconds)
local nSeconds = tonumber(sSeconds)
if nSeconds == 0 then
return "00:00:00";
else
nHours = string.format("%02.f", math.floor(nSeconds/3600));
nMins = string.format("%02.f", math.floor(nSeconds/60 - (nHours*60)));
nSecs = string.format("%02.f", math.floor(nSeconds - nHours*3600 - nMins *60));
return nHours..":"..nMins..":"..nSecs
end
end

01-08-2011 03:18 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
converting seconds to %H:%M:%S - mikshaw - 01-08-2011, 02:55 AM
RE: converting seconds to %H:%M:%S - mikshaw - 01-08-2011 03:18 AM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: