I\'m obviously not using filter_var() correctly. I need to check that the user has entered a valid date, in the form \"dd/mm/yyyy\".
This simply returns whatever I p
Why using a heavy RegEx, while there is a native DateTime PHP-class?
$value = 'badbadbad'; try { $datetime = new \DateTime($value); $value = $datetime->format('Y-m-d'); } catch(\Exception $e) { // Invalid date }
Always returns the format you were expecting, if a valid datetime string was inserted.