I have a excel file which has dates in multiple formats in no particular order. The formats vary
dd/mm/yyyy
dd/mm/yy
dd.mm.yyyy
dd.mm.yy
dd-mm-yyyy
dd-mm-yy
dd.Jan.18
dd-Jan-2018
I loop through the excel rows and fetch the dates one by one. How can I convert these dates to a particular format? Preferably yyyy-mm-dd I'm using PHP and storing the dates into mysql after processing.
I have tried this method but it doesn't work for dd.mm.yy
$date = $row[$datepos];
$date = str_replace('/', '-', $date);
$date = date("Y-m-d",strtotime($date));