<?php $input = '1990-09-15'; // $input = '15-09-1990'; // $input = '1990-49-85'; $a = DateTime::createFromFormat('Y-m-d', $input); if ($a === false) { echo "Invalid format\n"; } $lastError = DateTime::getLastErrors()['warnings'] ?? []; if (reset($lastError) === 'The parsed date was invalid') { echo "Invalid date\n"; }
You have javascript disabled. You will not be able to edit any code.