后台传来毫秒,前台转换成对应的时分秒
//在线时长
function longTime(seconds){
//总秒数
//seconds=seconds/1000;
//得到小时
var hour = seconds/3600;
var r = seconds%3600;
var m = r/60;
var s = r%60;
return parseInt(hour)+":"+parseInt(m)+":"+parseInt(s);
}
2022-12-03 15:49:58
后台传来毫秒,前台转换成对应的时分秒
//在线时长
function longTime(seconds){
//总秒数
//seconds=seconds/1000;
//得到小时
var hour = seconds/3600;
var r = seconds%3600;
var m = r/60;
var s = r%60;
return parseInt(hour)+":"+parseInt(m)+":"+parseInt(s);
}
下一篇:用JS遍历循环时覆盖了之前的值