Jump to content

Countdown timer based on seconds, not a specific date.


Nhoj

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.