How would you create a countdown timer that counts the number of days until an event will occur?
A:
You need to save a timestamp of that specific datetime, and count seconds to it :) and display them as days intval(seconds / 60 / 60 / 24)
canni
2010-08-20 13:13:12
+1
A:
If you want a client-side timer you could use a jQuery countdown.
See a live demo here.
Mark Byers
2010-08-20 13:14:28
ah ha, this does make more sense... thank you sir
hsatterwhite
2010-08-20 13:18:05
hsatterwhite said about PHP.
Alexander.Plutov
2010-08-20 13:28:24
@Alexander.Plutov: He also said "[A jQuery countdown] does make more sense".
Mark Byers
2010-08-20 13:31:57
A:
Try googling it. There are plenty of tutorials and ready made solutions:
http://www.brighthub.com/internet/web-development/articles/9471.aspx
http://php.about.com/od/learnphp/ht/countdown_php.htm
Also, you may try Javascript to create cool countdown timer with background images like on this page: http://www.getgyan.com/
(EDIT: this link is just a demo, does not have code to do so).
shamittomar
2010-08-20 13:17:30
A:
$event_date = '11-11-2011';
$event_timestamp = strtotime($event_date);
$now_timestamp = time();
$diff = $event_timestamp - $now_timestamp;
$days = round ($diff/(24*60*60));
Alexander.Plutov
2010-08-20 13:17:54