What I want to achieve is to make a div appear at a set time, which I've achieved (go me), My problem is with my current code I can only set the time in hours. I'd like to be able to set it in hours/minutes.
For example make the div appear between 9am and 10:30am. (Currently, I can only make it appear on "hours" only, so 9am to 10am for example.)
Here is where I set the time:
date_default_timezone_set('Europe/London');
$currentHour = date("H");
$day = date("1");
$nineAlertStart = 9;
$nineAlertEnd = 10;
Here is the function to display div on set time:
if ($currentHour >= $nineAlertStart && $currentHour < $nineAlertEnd){
// If we are, set our class to off.
$ninealert = 'timeOn';
} else {
// Otherwise, set our class to off.
$ninealert = 'timeOff';
}
And finally here is my output to display
<div class="alert <?php echo $ninealert; ?>">
Jade
</div>
I know not all of this code is needed but I thought it might help understand what I'm trying to achieve.