Mr Chris Posted August 12, 2010 Share Posted August 12, 2010 Hello, Im trying to work out some code. On my site between Thursday 12th July and Sunday 15th July between the hours of 22:00 and 23:00 I want to display some code. I've done this so far, but am having trouble. Anyone please help? $the_date = date("H:i:s"); $timesep = explode(":",$the_date); // $hour = $timesep[0]; if (($the_date > 2010-08-12 && < 2010-08-15) && ($hour >= 22) && ($hour <= 23)) { //Code } Link to comment https://forums.phpfreaks.com/topic/210569-help-output-some-code-during-a-date-range-for-an-hour/ Share on other sites More sharing options...
marcus Posted August 12, 2010 Share Posted August 12, 2010 <?php $date = date("m-d-y"); // 08-12-10 $dates = array('08-12-10','08-13-10','08-14-10','08-15-10'); $hm = date("H:i"); // 15:47 list($hour,$minute) = explode(":",$hm); if(in_array($date,$dates) && $hour == '22' && in_array($minute,range(0,59))){ // code } ?> Link to comment https://forums.phpfreaks.com/topic/210569-help-output-some-code-during-a-date-range-for-an-hour/#findComment-1098610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.