End of the world countdown
dont forget the prophecy :)
window.onload = function(){
var eotwss=setInterval(function(){eotw()},100);
}
function eotw(){
/* actual date */
var nDate = new Date();
var actualYear = nDate.getFullYear();
var actualMonth = nDate.getMonth();
var actualDate = nDate.getDate();
var actualHours = nDate.getHours();
var actualMinutes = nDate.getMinutes();
var actualSeconds = nDate.getSeconds();
/* date of the eotw */
var year = "2012" - actualYear;
var month = "11" - actualMonth; /*1=j 11=d*/
var date = "21" - actualDate;
var hours = "0" - actualHours;
var minutes = "0" - actualMinutes;
var seconds = "0" - actualSeconds;
var eoth = year + " annee " + month + " mois " + date + " jour " + hours + " heures " + minutes + " minutes " + seconds + "secondes";
document.body.innerHTML=eoth;
}
for the timezone juste : -YOURS * 3600
Written by Valentin Beuret
Related protips
3 Responses
Timezone? ;)
over 1 year ago
·
You don't need to call the date() function so often. Just store it into a var date = new Date();
Just a quick enhancement.
over 1 year ago
·
Hey, your right !
thanks, I'll change all this.
br,
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Javascript
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#