View Full Version : url redirect based on time & day of week

03-13-2003, 06:01 AM
Our site offers streaming audio on Thursday evening (7:30 to 8:30) and on Sunday morning (8:30 to 1:30p). How can I use PHP to direct the visitor to the audio streaming link only during these times. At all other times, I want a message that indicates when the streaming is available.

Thanks in advance for your suggestions!


03-13-2003, 07:29 PM
You might try something like this:

$day = date("D"); //returns "Mon" "Tue"
$time = date("Hi"); //returns HoursMinutes
if( ($day == "Thu" && $time >= "1930" && $time < "2030") ||
($day == "Sun" && $time >= "0830" && $time < "1330") )
header("Location: REDIRECT URL");

That should work, I am not absolutely positive about whether $day will be "Thu" or "Thr" on Thursday, but that should be correct. Hope that this helps.

03-13-2003, 08:28 PM
thanks for your help!


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum