Welcome to WebmasterWorld Guest from 54.157.222.62

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Time Countdown

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

10+ Year Member



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)

WebmasterWorld Senior Member 10+ Year Member



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

Birdman

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

10+ Year Member



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)

10+ Year Member



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