If the dates are in the same format than we will use a comparison operator. Let's see below example
<?php
$date_1 = "2023-10-01";
$date_2 = "2023-10-22";
if ($date_1 < $date_2) {
echo "$date_1 is less than $date_2";
else{
echo "$date_1 is greater than $date_2";
}
?>