标签:展示 floor return 前端 math stay mat 时分秒 time
let staytimeGap = new Date(closedtime).getTime() - new Date(createtime).getTime();
let stayHour = Math.floor(staytimeGap / (3600 * 1000));
let leave1 = staytimeGap % (3600 * 1000);
let stayMin = Math.floor(leave1 / (60 * 1000));
let leave2 = leave1 % (60 * 1000);
let staySec = Math.floor(leave2 / 1000);
stayHour = stayHour < 10 ? "0" + stayHour : stayHour;
stayMin = stayMin < 10 ? "0" + stayMin : stayMin;
staySec = staySec < 10 ? "0" + staySec : staySec;
return stayHour + ":" + stayMin + ":" + staySec;
标签:展示 floor return 前端 math stay mat 时分秒 time
原文地址:https://www.cnblogs.com/xiao1993/p/14693055.html