drk Posted April 4, 2012 Posted April 4, 2012 Hi all. I need help with time conversion. I'm not good at math and I need convert ms to min:sec. I have a function to convert the time but seconds appear like 0:4 instead of 0:04. I need convert it, can someone help? Function here: function convertTime ( time ) local min = math.floor ( time / 60000 ) local sec = math.floor ( ( time / 1000 ) % 60 ) return min, sec end
X-SHADOW Posted April 4, 2012 Posted April 4, 2012 Small Help to you ^^ http://www.unitconversion.org/time/mill ... rsion.html
drk Posted April 4, 2012 Author Posted April 4, 2012 Dude, why are you posting a miliseconds to seconds converter? -.- Edit: Ok, I used Race "msToTimeStr" function and worked.
X-SHADOW Posted April 4, 2012 Posted April 4, 2012 oh Sorry Man here its http://www.unitconversion.org/time/mill ... rsion.html
drk Posted April 4, 2012 Author Posted April 4, 2012 (edited) I DON'T WANT ANY MILLISECONDS TO SECONDS CONVERTER. What you don't understand in this ? I need a function to convert ms to minutes, seconds and the problem has been solved already. Edited April 4, 2012 by Guest
X-SHADOW Posted April 4, 2012 Posted April 4, 2012 oh Dude i dont fined any function about what you talking about so i give to the website ok iam really sorry about this
BeaTeX# Posted April 4, 2012 Posted April 4, 2012 LOL just write in GOOGLE ____ miliseconds to minutes/seconds
drk Posted April 4, 2012 Author Posted April 4, 2012 Dude, I don't wanna convert a time to put in a script, I need a function to convert time from getTimePassed function to min - sec -.- Why no one understand? Why you think I put the function in the topic? If I want just one time to a script I will not lost my time with a function.
Aibo Posted April 4, 2012 Posted April 4, 2012 -- will return STRING in the form of "00:00" function convertTime ( time ) local min = math.floor ( time / 60000 ) local sec = time / 1000 % 60 return string.format("%02d:%02d", min, sec) end
drk Posted April 4, 2012 Author Posted April 4, 2012 Thanks Aibo, but I don't need anymore I'm using "msToTimeStr" race function and it does the job
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now