Código:
<script type="text/javascript"> <!--hide from old browsers function countDown() { var today = new Date() var dayofweek = today.toLocaleString() dayLocate = dayofweek.indexOf(" ") weekDay = dayofweek.substring(0, dayLocate) newDay = dayofweek.substring(dayLocate) dateLocate = newDay.indexOf(",") monthDate = newDay.substring(0, dateLocate+1) yearLocate = dayofweek.indexOf("2011") year = dayofweek.substr(yearLocate, 4) var EarthDay = new Date("April 22, 2011") var daysToGo = EarthDay.getTime()-today.getTime() var daysToEarthDay = Math.ceil(daysToGo/(1000*60*60*24)) displayDate.innerHTML = "<h3>Today is "+weekDay+" "+monthDate+" "+year+". We have "+daysToEarthDay+" days until Earth Day.</h3> } --> </script>