Reputation: 28853
I'm trying to show a simple countdown from 2 hours like so:
$(function () {
var timeout = new Date(20000);
$('#countdown').countdown({until: timeout, compact: true, format: 'HMS'});
});
However I just get 00:00:00, any ideas why?
Upvotes: 0
Views: 114
Reputation: 56587
You get 00:00:00
, because new Date(20000);
is actually
Thu Jan 01 1970 00:00:20 GMT+0000 (GMT)
like 40 years ago. :D What you need to do is either:
var timeout = new Date(Date.now() + 20000);
or
var timeout = 20000;
By the way: two hours is not 20000
, it is
1000 (ms) * 60 (s) * 60 (min) * 2 == 7200000
Upvotes: 4