PDA

View Full Version : How do I count down to a date?


OM2
08-23-2005, 03:57 PM
I'm trying to create a counter that will countdown to a date and time.

I seemed to be getting lost with my coding.
I've got some simple code that counts down.
But, I'm having trouble trying to figure out how I can have a counter count down to a specific date.

(ALSO... if the date has passed... a different message should be displayed.)

Ideally, I'd like to do this in Flash 5 code to guarantee that the end user will probably have the Flash plugin.

How do I do this?

Any help would be appreciated.

Thanks.


OM

majicassassin
08-23-2005, 04:51 PM
if you use the function new Date() it gives you the current time, don't quote me on the exact commands, they're in the help file (don't remember if its getDay or getDays for example):

today = new Date()
today.getSeconds()
today.getHours()
today.getDay()
today.getYear()

each of those will return a numeric value, just take the day you're counting down to, and subtract these from it (tkaing into account flowover from one to the next, like 10 seconds minus 30 seconds means it goes to 40, and decrement minutes one)