【把秒转化成分钟】
var s = 65;//秒
alert(Math.floor(s/60)+'分'+ s%60 +'秒');//1分5秒 Math.floor()向上取整
注意:
Math.floor()向上取整;
Math.floor(s/60):只要整数,向上取整(即为分钟);
s%60:取余数(余数即为秒数);
【把秒转化成分钟】
var s = 65;//秒
alert(Math.floor(s/60)+'分'+ s%60 +'秒');//1分5秒 Math.floor()向上取整
注意:
Math.floor()向上取整;
Math.floor(s/60):只要整数,向上取整(即为分钟);
s%60:取余数(余数即为秒数);