利用转int会去掉尾数部分的特性,计算出时间间隔的时分秒
js
let all=188023520//相差的秒数
let yarnScound = 365 * 24 * 3600;
let dayScound = 24 * 3600;
let hourScound = 3600;
let minuteScound = 60;
let year = parseInt(all / yarnScound)
let day = parseInt((all - year * yarnScound) / dayScound)
let hour = parseInt((all - day * dayScound - year * yarnScound) / hourScound);
let minute = parseInt((all - day * dayScound - hour * hourScound - year * yarnScound) / minuteScound)
let seconds = all % 60;
return `${year}年${day}天 ${hour}小时 ${minute}分钟 ${seconds}秒`