subsequent
timeElapse = (BigEvent.getTime() - today.getTime());
include
if(timeElapse <=0 ) {
return;
}
or if you desire to display 0 at the end:
BigEvent = new Date("November 14, 2013 14:50:55")
function timer(){
today = new Date();
millisecondsPerDay = 24 * 60 * 60 * 1000;
timeElapse = (BigEvent.getTime() - today.getTime());
estimatedDaysLeft = timeElapse / millisecondsPerDay;
daysRemaining = Math.max(0, Math.floor(estimatedDaysLeft));
estimatedHoursLeft = (estimatedDaysLeft - daysRemaining)*24;
hoursRemaining = Math.max(0, Math.floor(estimatedHoursLeft));
estimatedMinutesLeft = Math.max(0, (estimatedHoursLeft -hoursRemaining)*60);
minutesRemaining = Math.floor(estimatedMinutesLeft);
estimatedSecondsLeft = Math.max(0, (estimatedMinutesLeft - minutesRemaining)*60);
secondsRemaining = Math.floor(estimatedSecondsLeft);
document.getElementById('offer2').innerHTML = "<H4>" + daysRemaining +
":Days " + hoursRemaining +":Hrs " + minutesRemaining + ":Mins " + secondsRemaining + ":Secs Left</H4> ";
if(timeElapse <=0 ) {
return;
}
setTimeout(function(){timer()},1000);
}
setTimeout(function(){timer()},1000);