If both dates are in the same format then use a comparison operator.
$date1 = "2018-05-05";
$date2 = "2019-08-19";
//comparison operator to
if ($date1 > $date2) {
echo "$date1 is latest than $date2";
}
else{
echo "$date1 is older than $date2";
}
Output:
2018-05-05 is older than 2019-08-19