$expires = DateTime::createFromFormat('my', $_POST['expMonth'].$_POST['expYear']); $now = new DateTime(); if ($expires < $now) { echo 'Expired!'; }