3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function validateDate($date, $format = 'Y-m-d H:i:s') { $d = DateTime::createFromFormat($format, $date); return $d && $d->format($format) == $date; } echo validateDate('2012-02-30 12:12:12'); echo validateDate('30/02/2012', 'd/m/Y'); echo validateDate('14:77', 'H:i'); echo validateDate('2012-02-28 12:12:12');
based on Nt0uC
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.3.0alpha1
1