I am working with arrays of values in PHP. Some of these values may include a date in various string formats.
I need to convert dates in multiple formats to their numeri
Extrapolating from http://au1.php.net/checkdate#113205 ; just change the $formats array to all the formats you want to check.
public function convertDate($value) {
$formats = ['M d, Y', 'Y-m-d'];
foreach($formats as $f) {
$d = DateTime::createFromFormat($f, $value);
$is_date = $d && $d->format($f) === $value;
if ( true == $is_date ) break;
}
return $is_date;
}