I could have any value in milliseconds like:
1040370
I must alert a specific converted time format : _m_s
(ie:17m20s
)
Here is how I do it:
function ms(a){
var m = a/1000/60,
s = Math.floor(('0.'+(''+m).split('.')[1])*60);
m = (''+m).split('.')[0];
alert(m+'m'+s+'s');
}
ms(1040370);
What do you think? Is it satisfactory or is there a better way to accomplish the same?