redfieldr Posted June 27, 2012 Share Posted June 27, 2012 I'm the web master for a local radio station, but am not a php pro in any context of the word. I was able to fumble my way through php in order to set up an hourly image rotator for the top of the site. (It displays which announcer is on the air). I'm wanting to do the same for our contests, but they fall at various times (7:50am, 12:20pm, etc). One segment of the rotator script appears like this: <?php // Get the day of week (Sun=0, Mon=1 ... Sat=6) $day=date("w"); // If it's Mon-Fri, check the time if($day ==0){ // Get the Hour (24 hr) $hour=date("G"); // between times? if($hour >= 0 && $hour < 13){ // Display your image here echo "<img src='http://www.station.com/timer/images/rotator_img.png' alt='' /><br />"; } } It works fine for hours, but I cannot for the life of me figure out how to convert it for use with Minutes (I want to display "Next Contest Coming Up" and "TUNE IN NOW to play" images). Thanks in advance for whomever can point me in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/264888-image-rotator-based-on-minutes/ Share on other sites More sharing options...
Yawa Posted June 27, 2012 Share Posted June 27, 2012 you could try something like this: <? $current_time = date(G); if ($current_time >= [start] || $current_time < [end]) { // Display your image here } ?> Read more about using date()-function here : http://no2.php.net/manual/en/function.date.php Quote Link to comment https://forums.phpfreaks.com/topic/264888-image-rotator-based-on-minutes/#findComment-1357501 Share on other sites More sharing options...
redfieldr Posted June 27, 2012 Author Share Posted June 27, 2012 Thank you! I will give it a shot Quote Link to comment https://forums.phpfreaks.com/topic/264888-image-rotator-based-on-minutes/#findComment-1357513 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.