const nowTemp = new Date().getTime(); //获取当前时间戳 const tomorrowTemp = new Date(moment().add(1, 'days').format().substr(0, 10) + ' 00:00:00').getTime(); //获取今天24:00的时间戳 const residueTemp = tomorrowTemp - nowTemp; //距离当天24:00的时间戳 console.log(residueTemp) setTimeout(()=>{ //次天0点 执行每天24;00 刷新 setInterval(() => { //需要调用的方法 }, 1000*60*60*24); },residueTemp)
本文来自博客园,作者:哈利波特甜,转载请注明原文链接:https://www.cnblogs.com/zmh-980509/p/15724657.html