I have this code which I used on another site to show the open and closed status for a shop. I am using it for another shop which is open past or up to midnight. Because of this, the code thinks the shop is closed as it is registering the time as after the closed time because it's '00'.
Here is the code:
$todays_date = date("D");
if($todays_date == 'Fri' || $todays_date == 'Sat'){
$open_hours = '2pm - 1am';
$open = '14';
$close = '01';
$close_soon = '00';
} else {
$open_hours = '4pm - 12am';
$open = '16';
$close = '00';
$close_soon = '23';
}
$hour_now = date("H");
if($hour_now == $close_soon){
$open_close_text = '<span style="color:#F60"><b>Closing Soon</b></span>';
} else {
if($hour_now > $open && $hour_now < $close){
$open_close_text = '<span style="color:#090"><b>Open Now</b></span>';
} else {
$open_close_text = '<span style="color:#F00"><b>Closed Now</b></span>';
}
}
Is there any way to correct this issue? I think I would also have a problem when the day flicks over to Mon after midnight on Sun it would show as closed at midnight but that shouldn't occur?
Thanks.