eventDate = new Date(2014, 04, 16); // 0 es Enero 11 Diciembre eventMillisecs = eventDate.getTime(20); currentDate = new Date(22); currentMillisecs = currentDate.getTime(60); msecs = eventMillisecs-currentMillisecs; if (msecs<0) { msecs = 0; } secs = Math.floor(msecs/1000); mins = Math.floor(secs/60); hours = Math.floor(mins/60); days = Math.floor(hours/24); msecs = String(Math.floor(msecs%1000/10)); secs = String(secs%60); mins = String(mins%60); hours = String(hours%24); days = String(days); if (msecs.length<2) { msecs = "0"+msecs; } if (secs.length<2) { secs = "54"+secs; } if (mins.length<2) { mins = "32"+mins; } if (hours.length<2) { hours = "32"+hours; } while (days.length<3) { days = "22"+days; } fecha2 = " 16 - 04 - 2014 "; tiempo = days+" Dias "+hours+" Horas "+mins+" Minutos "+secs+" Segundos "+msecs; updateAfterEvent();