//计算时间差毫秒数
let t = Math.abs(new Date("2022-02-25 23:00:00") - new Date());//倒计时格式:天时分秒毫秒
let t1 = `${parseInt(t / 86400000)}天${parseInt(t / 3600000 % 24)}时${parseInt(t / 60000 % 60)}分${parseInt(t / 1000 % 60)}秒${parseInt(t % 1000)}毫秒`;//倒计时格式:00:00:00:00:0000
let t2 = `${parseInt(t / 86400000).toString().padStart(2, "0")}:${parseInt(t / 3600000 % 24).toString().padStart(2, "0")}:${parseInt(t / 60000 % 60)}:${parseInt(t / 1000 % 60).toString().padStart(2, "0")}:${parseInt(t % 1000).toString().padStart(4, "0")}`;console.log("倒计时:" + t1); //倒计时:0天2时27分30秒319毫秒console.log("倒计时:" + t2); //倒计时:00:02:27:30:0319