Comparing Timestamp with Time Points in PHP
You can compare dates by first converting them to timestamp format. Let's look at an example. Suppose we have two dates in the following format:
<?php
$date1 = ['2020', '12', '01'];
$date2 = ['2019', '12', '31'];
?>
Let's convert the dates to timestamp format:
<?php
$time1 = mktime(0, 0, 0, $date1[1], $date1[0], $date1[2]);
$time2 = mktime(0, 0, 0, $date2[1], $date2[0], $date2[2]);
?>
Let's compare these dates:
<?php
var_dump($time1 > $time2);
?>
Compare two dates by first converting them to timestamp:
$date1 = '2020-11-30';
$date2 = '2020-12-01';