I want to compare datetime column in mysql db with today.
Actually I want to add an if string, so if the return result is greater than a given number, it does something, and if it's smaller it does something else.
Can you help me out here?
I want to compare datetime column in mysql db with today.
Actually I want to add an if string, so if the return result is greater than a given number, it does something, and if it's smaller it does something else.
Can you help me out here?
fetch DateTime from the database and compare with PHP default function now(). for make condition use if condition.
Sorry guys, for the late reply, but I managed to figure it out myself... Here is the result:
$date1 = date_create($row["column"]);
$date2 = date_create(date("Y-m-d");
$interval = date_diff($date1, $date2);
if ($interval->format('%R%a days') < 350) { echo '<td class="column-table">';
echo $interval->format('%R%a days');
echo '</td>';
}
Sorry for the inconvenience.