How to convert seconds (decimal value) into minutes:seconds:miliseconds (if seconds > 60)
I have a variable that is in decimal seconds.
Example: 92.5
How do I convert it to 1:32:50?
I have a variable that is in decimal seconds.
Example: 92.5
How do I convert it to 1:32:50?
Sorry, 92.5 is 1:32.50 (that is 1 minute 32 seconds and 50 milliseconds)
and the value will never exceed 1 hour.
Then you can use this code:
var v = 92.5;
var minutes = Math.floor(v/60);
v-=(minutes*60);
var seconds = Math.floor(v);
var remainder = (v-seconds)*100;
var result = minutes + ":" + seconds + ":" + remainder;
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.