Using PHP CheckDate to validate dates
<?php $month = 2; // February never has 31 days $day = 31; // 31st $year = 2018; // 2018 if (checkdate($month, $day, $year)) { echo "Date is valid"; } else { echo "Date is invalid"; } ?>
Output:
Date is invalid