hjpotter92
0
Q:

php check credit card expiration

$expires = DateTime::createFromFormat('my', $_POST['expMonth'].$_POST['expYear']);
$now     = new DateTime();

if ($expires < $now) {
    echo 'Expired!';
}
1
$expires =  date_format( \DateTime::createFromFormat('ym', $cc_expiration),"ym");

$now =  date_format(new \DateTime(),"ym");

if ($expires < $now) {
    return 'Expired!';
}
0

New to Communities?

Join the community