homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

Time Countdown

 12:40 pm on Apr 12, 2004 (gmt 0)

time is something ive never had to deal with in php but i wanted to do a small script for my site

the school day is split into somethign like 6 periods and lunch (but lunch is differnt for 2 groups) on the main page i wanted to show the time and what period it is for the two groups e.g.

Tuesday 14th March 12:49
Lower School - Lunch - 11 mins till Period 6
Sixth Form - Period 6 - 61 mins till End Of School

any ideas how this could be accomblished



 1:23 pm on Apr 12, 2004 (gmt 0)

Take a look at the date section [php.net] in the PHP manual. It is very helpful.



 12:32 am on Apr 13, 2004 (gmt 0)

At any point during the countdown you have a start time (i.e. now) and an end time.

A standard method is to work out the difference between the two times in seconds, and then work out how many multiples of 'whole' periods are in that difference (i.e. years, months, days etc.) where a minute is 60 seconds, an hour is 3600 and so on.

Do a search for 'PHP countdown scripts' on Google and you will find some useful code snippets ;).


 2:14 am on Apr 14, 2004 (gmt 0)

honestly though, if you want a very interesting countdown, the way to go is JavaScript, it can update without refreshing the browser

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved