// Javascript function to calculate time left to a particular deadline date
function timeLeft()
{
var now = new Date();
var end = new Date(targetDate);
var endOffset = end.getTime() / 1000;
var startOffset = now.getTime() / 1000;
var length = Math.floor(endOffset - startOffset);
DAYS = Math.floor(length / 86400);
length = length % 86400;
HRS = Math.floor(length / 3600);
length = length % 3600;
MINS = Math.floor(length / 60);
length = length % 60;
SEC = length;
var timeRemaining = DAYS + " DAYS, " + HRS + " HRS, " + MINS +
" MINS, " + SEC + " SEC";
document.getElementById("countdown").innerHTML = timeRemaining;
}
//Change the date to your target date
var targetDate = "March 17, 2010 10:49 PM EDT";
window.onload = function() {
setInterval("timeLeft()", 1000);}
