This question already has an answer here:
- How to compare two dates in php 13 answers
- PHP date time greater than today 1 answer
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