如何通过node.js访问Console.log countdownjs模块
我正在使用模块如何通过node.js访问Console.log countdownjs模块,node.js,Node.js,我正在使用模块 ,如何在3天后通过node.js来Console.log countdownjs?下面是一个如何使用倒计时模块的小示例: var now = new Date(); var durationInDays = 3; var durationInMilliseconds = (durationInDays * 24 * 60 * 60 * 1000); var future = now.getTime() + durationInMilliseconds; var countdown
,如何在3天后通过node.js来Console.log countdownjs?下面是一个如何使用倒计时模块的小示例:
var now = new Date();
var durationInDays = 3;
var durationInMilliseconds = (durationInDays * 24 * 60 * 60 * 1000);
var future = now.getTime() + durationInMilliseconds;
var countdownInfo = countdown(now, future);
// print it once
console.log(countdownInfo.toString());
// print it every 5 seconds
function repeatedPrint() {
setTimeout(function () {
// you have to provide a new start date to get updated information
countdownInfo = countdown(new Date(), future);
console.log(countdownInfo.toString());
repeatedPrint();
}, 5 * 1000);
}
repeatedPrint();