ok i've figured out how to do a countdown but can't figure out how to format it so it looks how i want, i want to be able to play with the word days and make it bigger different colors etc. here is the code i used
now = new Date();
euro = new Date (2002, 7, 25, 10, 30, 0);
days = (euro-now)/1000/60/60/24;
daysRound = Math.floor(days);
hours = (euro-now)/1000/60/60-(24*daysRound);
hoursRound = Math.floor(hours);
minutes = (euro-now)/1000/60-(24*60*daysRound)-(60*hoursRound);
minutesRound = Math.floor(minutes);
seconds = (euro-now)/1000-(24*60*60*daysRound)-(60*60*hoursRound)-(60*minutesRound);
secondsRound = Math.round(seconds);
if (secondsRound == 1) {
sec = " second ";
} else {
sec = " seconds ";
}
if (minutesRound == 1) {
min = " minute ";
} else {
min = " minutes ";
}
if (hoursRound == 1) {
hr = " hour ";
} else {
hr = " hours ";
}
if (daysRound == 1) {
dy = " day ";
} else {
dy = " days ";
}
timeRemaining = daysRound+dy+hoursRound+hr+minutesRound+min+secondsRound+sec;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.