PHP

Compare two dates in PHP

If you want to compare two dates just convert to your dates to Unix Time stamp, compare them and you have your result. The code will look something like below,

$exp_date = "2015-10-01";
 $todays_date = date("Y-m-d");

$today = strtotime($todays_date);
 $expiration_date = strtotime($exp_date);

if ($expiration_date > $today) {
 // Yes, this is...
 } else {
 // Yes, this is...
 }

Thanks…

Comment here