3
When comparing timetables I have in the registered database the opening and closing hours of an establishment. I’m having a problem comparing the hours to see if the establishment is open or closed, it’s always appearing to me as open when it’s past time.
<?php
$horario = strtotime(date('H:i'));
$result_horario_estado=mysql_query("select * from horarios where id_mae='".$row->id."'");
$row_horario_estado=mysql_fetch_array($result_horario_estado);
$abertura   = strtotime($row_horario_estado['horario_abertura']);
$fechamento = strtotime($row_horario_estado['horario_fechamento']);
if($horario >= $abertura || $horario <= $fechamento) {
?>
    <div style="margin:-3px 0px 5px 0px; width:257px; font-family:Arial, Helvetica, sans-serif; color:#0C3; font-size:13px;">Aberto</div>
<?php
} else {
?>
    <div style="margin:-3px 0px 5px 0px; width:257px; font-family:Arial, Helvetica, sans-serif; color:#F00; font-size:13px;">Fechado Agora</div>
<?php
}
?>

Guy include this: date_default_timezone_set('America/Sao_paulo'); Depending on your location... try to give one
echoIn your present hour you’re hitting it right.– Ronan Gill
I personally prefer to work with
gmt(gmdate(...)) and convert the hours according to "the region" or user preference. If you usedate()you may have many problems with time zones and "poorly configured" servers. I have a VPS service and there was some problem in the upgrade, I just had problem with several things, including the schedule. Correct me I’ve said something wrong.– Guilherme Nascimento