首页 > 代码库 > 倒计时思想

倒计时思想

commitTimeDate = new Date("2016/11/9 10:02:40").getTime() + 24*60*60*1000;//截止时间
myDate = new Date();//获取当前时间
currentTime=myDate.getTime();//当前时间换成毫秒
deadlineTime = commitTimeDate - currentTime;//时间差
let reminderHour = Math.floor(deadlineTime / (1000 * 60 * 60));//倒计时要写的小时
let reminderSecond = Math.floor(deadlineTime / (1000 * 60)- reminderHour*60);//倒计时要填的分钟
let reminderMinute = Math.floor(deadlineTime / 1000 - reminderSecond*60 - reminderHour*60*60);//倒计时要填的秒


倒计时思想