//定义计算总时间方法
timeTotal = t => {
let t1 = t
.replace('天', ':')
.replace('小时', ':')
.replace('分', ':')
.replace('秒', '');
let t2 = t1.split(':');
let S = Number(t2[t2.length - 1]) ? Number(t2[t2.length - 1]) : 0;
let M = Number(t2[t2.length - 2]) ? Number(t2[t2.length - 2]) : 0;
let H = Number(t2[t2.length - 3]) ? Number(t2[t2.length - 3]) : 0;
let D = Number(t2[t2.length - 4]) ? Number(t2[t2.length - 4]) : 0;
let S1 = S + M * 60 + H * 60 * 60 + D * 24 * 60 * 60;
return S1;
};
1天3小时3分4秒格式时间转秒
最新推荐文章于 2022-06-22 03:14:37 发布