Error comparing hours past 00:00:00?

Asked

Viewed 18 times

-3

I have the following code that makes the calculation to see if the deadline has expired for example ORDER TIME -> 23:20:00 AND DELIVERY TIME 23:59:00 but when it passes 00:00 the deadline returns as if it had not expired, only when it is past the deadline again on the other day that it has expired, would anyone know how to solve?

<?php
date_default_timezone_set('America/Bahia');
$prazo_final = date('H:i:s', strtotime('+'.$row["tempo_pedido"].'minute', strtotime($row["hora_pedido"])));
$hora_agora = date('H:i:s');

$converte_prazo_final = strtotime($prazo_final);
$converte_hora_agora = strtotime($hora_agora);


    if($converte_hora_agora>$converte_prazo_final){
        echo "o prazo expirou!";
    }
  • 1

    To proceed with the doubt is important [Dit] and exchange the code for a [mcve] of the problem. I can already say that if you do not use the full date, there is no way the code to guess that you are talking about the time of the next day when it passes 0h00 (there is no way to differentiate whether it is "today" or tomorrow, after, etc).

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.