jeudi 4 octobre 2018

How can I fix my if statement Date comparison [duplicate]

This question already has an answer here:

I need help with my code. Because it is not working and I don't see why.

<?php 
    // select all tasks if page is visited or refreshed
    $tasks = mysqli_query($db, "SELECT * FROM tasks ORDER BY dates");
    $i = 1; while ($row = mysqli_fetch_array($tasks)) { 
        $style= "";
        $date = $row['Dates'];
        $dates1= date("d-m-Y", strtotime($date));
        if ($dates1 < date("d-m-Y")){
            $style="<div class=timer-off><i style= color: red; . class=material-icons>timer_off</i> ";
        }
?>

I am trying to compare the database date with the current date. But the comparison is only working on the days.

I hope I explained my problem clearly.

Aucun commentaire:

Enregistrer un commentaire