function minux(a, b) {
let origin = a.split("-");
let result = b.split("-");
if (Number(result[1]) > Number(origin[1])) {
if (Number(result[2]) >= Number(origin[2])) {
let ss1 = Number(result[1]) - Number(origin[1]);
let ss2 = Number(result[2]) - Number(origin[2]);
if (Number(result[3]) > Number(origin[3])) {
return ss1 * 60 * 1000 + ss2 * 1000 + Number(result[3]) - Number(origin[3]);
} else {
return ss1 * 60 * 1000 + (ss2 - 1) * 1000 + Number(result[3]) + 1000 - Number(origin[3]);
}
} else {
let ss1 = Number(result[1]) - Number(origin[1])-1;
let ss2 = Number(result[2]) + 60 - Number(origin[2]);
if (Number(result[3]) > Number(origin[3])) {
return ss1 * 60 * 1000 + ss2 * 1000 + Number(result[3]) - Number(origin[3]);
} else {
return ss1 * 60 * 1000 + (ss2 - 1) * 1000 + Number(result[3]) + 1000 - Number(origin[3]);
}
}
} else {
//分钟数等于
let ss = Number(result[2]) - Number(origin[2]);
if (Number(result[3]) > Number(origin[3])) {
return ss * 1000 + Number(result[3]) - Number(origin[3]);
} else {
return (ss - 1) * 1000 + Number(result[3]) + 1000 - Number(origin[3]);
}
}
}
console.log(minux("16-38-12-468", "16-39-17-255"));
console