comparing php datetime code example
Example 1: php compare two dates
$today = date("Y-m-d");
$expire = $row->expireDate; //from database
$today_time = strtotime($today);
$expire_time = strtotime($expire);
if ($expire_time < $today_time) { /* do Something */ }
Example 2: date comparison function in php
Select if(Date('2020-10-01') > Date('2020-11-01'), '1', '2' ) as rslt_date