Jump to content

Archived

This topic is now archived and is closed to further replies.

Nhoj

Countdown timer based on seconds, not a specific date.

Recommended Posts

I have a value stored in the database as seconds until something happens and I was wondering how I'd make a countdown that counts down starting from that number of seconds and going to zero.

Basically I want it to pull something like 3600 for 1 hour and countdown to 0. The part I can't figure out how to do though is make it count down based on just seconds, I have an older script that does what I need but it does it based on a date / time, i.e. Jan, 1st, 2006 5:00 AM, this worked but was a little fudged when people were in different timezones.

I also need it to display in the format '00:00:00' (hh:mm:ss) and be able to countdown a maximum of 172800 seconds (48 hours). When it hits zero I also need it to show 00:00:00 instead of counting in the negatives.

I'd prefer if the javascript simply updated a <span id=clock>[clock]</span> kind of thing, or even a div.
I'm not too picky.....a disabled form input box would also work.

If anyone can help I appreciate it and thanks in advance ;D

Share this post


Link to post
Share on other sites
Care to post the solution?

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.