How to countdown for a few minutes?
You can countdown the timer for a few minutes like that:
$(document).ready(function() {
function formatDate(date) {
var year = date.getFullYear();
var month = ('0'+(date.getMonth()+1)).slice(-2);
var day = ('0'+date.getDate()).slice(-2);
var hour = ('0'+date.getHours()).slice(-2);
var minute = ('0'+date.getMinutes()).slice(-2);
var second = ('0'+date.getSeconds()).slice(-2);
return year+"/"+month+"/"+day+" "+hour+":"+minute+":"+second;
}
var startDate = new Date();
var endDate = new Date(startDate);
var addMinute = 3; //Change minutes
endDate.setMinutes(endDate.getMinutes()+addMinute);
//Countdown timer
$(".countdown").circleTimer({
startDate:formatDate(startDate),
endDate:formatDate(endDate),
showDay:false,
showHour:false,
timeZone:-5, //Time zone of New York (Change time zone)
onFinish:function() {
alert("Countdown ended");
}
});
});
You should write your time zone to make it work properly.