Jump to content

Help output some code during a date range for an hour?


Mr Chris

Recommended Posts

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
}

 

<?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
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.