Created
October 4, 2013 11:34
-
-
Save ManuelColombo/6824590 to your computer and use it in GitHub Desktop.
Simple timer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = new Date(); | |
var date = [ | |
new Date(2012, 8, 14), | |
new Date(2012, 8, 19), | |
new Date(2012, 8, 25) | |
//var endData = new Date(year, month, day, hours, minutes, seconds, milliseconds); | |
]; | |
$(function start(){ | |
for(i=0; i<3; i++){ | |
date[i].setTime( date[i].getTime() - data.getTime() ); | |
} | |
timer(date); | |
}); | |
function timer(){ | |
for(i=0; i<3; i++){ | |
if(data.getTime()>0){ | |
Gg = data.getDate(); | |
if(Gg==1) Gg+=' gg'; else Gg+=' gg'; | |
Hh = data.getHours(); | |
if(Hh<10) Hh = "0" + Hh; | |
Mm = data.getMinutes(); | |
if(Mm<10) Mm="0"+ Mm; | |
/*Ss = data.getSeconds(); | |
if(Ss<10) Ss = "0"+ Ss;*/ | |
$('.calendari a span.timer'+i).html(Gg + ' ' + Hh + ':' + Mm + '’');//:' + Ss + '”'); | |
} | |
} | |
window.setTimeout("timer();", 60000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment