Last Updated: February 25, 2016
·
1.829K
· beuretv

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

3 Responses
Add your response

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
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside