Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

countdown

Status
Not open for further replies.

wakkoguy

Technical User
Oct 30, 2001
84
US
does anyone know how to do a countdown to august 25 that shows off days, minutes and seconds?
 
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;
 
Regards,

new.gif
 
that's a good one old,

glad to see still here. This forum would be lost without guys like you.

Big Dave's been MIA this days. I wonder how he's been?


ciao

biggie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top