Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

- Time Management -

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

- Time Management -

Postby Curiousguy » Thu Sep 04, 2003 7:53 am

How to create a time verification script that .?

For Example: If There is three Classes, and "Class A" is only available between 10am - 1030am, and "Class B is only available between 1200pm - 1300pm... How do i using the Pull down menu to list out only the available class for the certain time, let say "Class A" is only available in the Pull down menu when the time is between 10am - 1030am?

PLs help .... thanks
New php-forum User
New php-forum User
Posts: 3
Joined: Thu Sep 04, 2003 7:48 am

Postby tryton » Thu Sep 04, 2003 3:38 pm

Your best bet is to grab the system timestamp and then compare for each value. Try to find a script that has already been written.
User avatar
New php-forum User
New php-forum User
Posts: 49
Joined: Wed Jul 09, 2003 8:25 am
Location: Joze

Postby Joel » Thu Sep 04, 2003 11:35 pm

To get the current hour do this.

Code: Select all
$currhour = date("H", time());

Then with your pull down menu have a switch statement deciding which choice to use. Remember, the hour will be the servers hour rather than the users timezones hour.
New php-forum User
New php-forum User
Posts: 193
Joined: Sat Mar 29, 2003 11:57 pm
Location: Auckland, New Zealand

Postby Redcircle » Fri Sep 05, 2003 3:40 pm

if you are unsure what timezone your server is in you can use gmdate('H', time()) which always outputs GMT

you will then need to calculate your time offset

EST this is (60*60)*(-5)
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.