Seeking javascript based countdown timer that allows for multiple simultaneous instances on the same page

I have a page on a site that I'm maintaining which displays multiple "time left until the end of the auction" values that are in the following format:

12d 1h 2m 49s
8d 21h 34m 12s
7d 3h 50m 8s

Each of these different time values are displayed in their own table row, and I was wondering if it might be possible for me to add some javascript to the page that would animate the values so that they decrement -- so that you can actually see the timers counting down.  How would I implement something like this?

Note that I don't really have the option of changing the time format that I'm currently using, .. so ideally, I'm looking for something that would work with what I already have.

Thanks in advance,
- Yvan
Who is Participating?
PyromanciConnect With a Mentor Commented:
You can use

And just do multiple instances. It has a lot of formatting and layout customization options to it.


		until: targetForCountdown,
		layout: '{dn}d {hn}h {mn}m {sn}s'

Open in new window

egoselfaxisAuthor Commented:
This is great -- exactly what I was looking for.  Thanks so much!

Just one last question -- My dates (that I'm seeding the function with) are currently in Unix date/time format, .. which is resulting in countdown timers that are obviously incorrect.

How would I convert/format the Unix date/times so that the timer counts down correctly?

$('#timer1').countdown({ until: 1361036439 });

(I'm using PHP, btw)

- Yvan
egoselfaxisAuthor Commented:
Nevermind -- I just figured it out!
$rawtime = "'+$rema[days]d +$rema[hours]h +$rema[minutes]m +$rema[seconds]s'";

Open in new window

 Thanks again!

- Yvan
A simpler way would be something like if your using php 5:

until: new Date('<?php echo date('c', 1361036439);?>')
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.