Welcome to WebmasterWorld Guest from 23.20.110.176

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Time Countdown

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

Junior Member

10+ Year Member

joined:Apr 11, 2004
posts:71
votes: 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)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Apr 22, 2002
posts:2546
votes: 0


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)

Full Member

10+ Year Member

joined:Dec 3, 2002
posts:260
votes: 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)

Preferred Member

10+ Year Member

joined:Nov 12, 2003
posts:454
votes: 0


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