Jump to content


Photo

Countdown timer based on seconds, not a specific date.


  • Please log in to reply
2 replies to this topic

#1 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 21 October 2006 - 05:36 AM

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
Avid PHP Developer, need some work done? Send a PM ;)

#2 Nhoj

Nhoj
  • Members
  • PipPipPip
  • Advanced Member
  • 223 posts
  • LocationClearwater, FL

Posted 22 October 2006 - 01:56 AM

NVM, I got it working ;D
Avid PHP Developer, need some work done? Send a PM ;)

#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 22 October 2006 - 09:17 PM

Care to post the solution?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users