Snooble Posted January 15, 2010 Share Posted January 15, 2010 Thanks in advance! I run a club night every Wednesday at 8pm, I want a countdown to the night on my website at all times. So if it's Tuesday "Get yourself ready for tomorrow!", if it's Monday "2 days, 4hours, 34minutes, 20seconds till we start". Also, I'd like it to count down live.. so I guess I need to use javascript too? Thanks so much, i'd be greatful for any help. Snoobs Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/ Share on other sites More sharing options...
oni-kun Posted January 15, 2010 Share Posted January 15, 2010 You can use PHP with AJAX to update the time and keep track of it if need be. You can calculate the difference between the dates with the unix time stamp, as it is in seconds it'll be that much simpler in the long run. If you're wanting more specific examples, give us a specific code you're having trouble with. Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995535 Share on other sites More sharing options...
Snooble Posted January 15, 2010 Author Share Posted January 15, 2010 Thanks for the reply! Can I just use a countdown, based on hours on repeat.. Like a.. 168 hour countdown starting on wednesday? I know nothing about AJAX.. Snoobs Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995554 Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 Do you want a countdown timer that will actually count down in real-time or just a user visits or refreshes the page? There is HEAPS of scripts out there for PHP that will do a countdown for you and you can just tweak it to have your little messages at certain times.. If you want a real-time counter you would use javascript which I would, personally have PHP pass the value to the JS and let JS take over from there.. Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995558 Share on other sites More sharing options...
Snooble Posted January 15, 2010 Author Share Posted January 15, 2010 I would like to display how many days/hours/minutes left until 8pm Wednesday. Counting down in realtime. Can I please have some sort of direction? What function do I use? How to I make it do this every week and not just for a single date. help help help. Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995563 Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 Have a look at this.. http://www.dynamicdrive.com/dynamicindex6/dhtmlcount.htm Use PHP to determine the next wednesday and pass it into the script.. Its amazing what a little googling can do.. Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995568 Share on other sites More sharing options...
Snooble Posted January 15, 2010 Author Share Posted January 15, 2010 I have read that already.. But I'm missing the link between php and javascript. How do I find out the next wednesday? and output it in this format: 1/20/2010 8:00 PM Thank you, I just can't find anything to help me on google. Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995570 Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 <?php $next_wed = date('m/d/Y g:i a',strtotime('next wednesday')); ?> You will have to do some checks to make sure if today is wednesday before 8pm otherwise it will do next wednesday on all wednesdays (if that makes any sense) Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995576 Share on other sites More sharing options...
Snooble Posted January 15, 2010 Author Share Posted January 15, 2010 Thank you! That's what I needed.. strtotime.. So, if I check the current day, If it's Wednesday echo "It's time", if it's not, echo the timer. Make sense? Or am I jumping ahead? Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995581 Share on other sites More sharing options...
Buddski Posted January 15, 2010 Share Posted January 15, 2010 That sounds good to me.. but you can go 1 better if you want and make it countdown to the very last second with something like this. if (todays_day == wednesday && time < 8pm) { // set the javascript date to 8pm today } else { // get the next wednesday at 8pm } Quote Link to comment https://forums.phpfreaks.com/topic/188568-time-and-date-countdown-desperate-help/#findComment-995587 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.