我正在尝试使用Flipclock.js制作倒计时时钟,直到 2017 年 1 月 20 日大约下午 12:00 就职典礼
如何计算当前时间与该日期/时间之间的差异(以秒为单位)?
我目前有:
var inauguration = new Date("January 20, 2017 12:00:00");
var now = Date.now();
var diff = inauguration - now;
var clock = $('#clock').FlipClock(diff, {
countdown: true,
clockFace: "DailyCounter"
});
得到它的工作:
var inauguration = new Date(2017, 00, 20, 12, 0, 0, 0);
var now = Date.now();
var diff = inauguration.getTime() - now;
diff = diff / 1000;
var clock = $('#clock').FlipClock(diff, {
countdown: true,
clockFace: "DailyCounter"
});