Date comparison code [duplicate]

0

I have a code that compares the current date with a specific date and verifies that this "delivery" is late in the day or expires today for example, but even if it is the same date as the current one, the else does not appear "in day" no It happens that you can help me thank you

$hoje = new DateTime();

echo $hoje->format("d/m/Y");

$entrega = new DateTime('2018-07-10');

echo "<br><br>";

if ($hoje > $entrega) {
    echo "Atrasado";
    echo "<br><br>";
    $interval = $hoje->diff($entrega);
    echo "$interval->days dias";

} else if ($hoje == $entrega) {
    echo "Vence hoje";
} else {
    echo "Em dia";
}
    
asked by anonymous 10.07.2018 / 07:05

0 answers