I have an excel sheet with dates in Y/m/d H:i:s format. But in case if a user accidentally typed 2019/29/10 16:20:10 (ie, Y/d/m H:i:s) format it should convert to Y-m-d H:i:s format as 2019-10-29 16:20:10.
I have used the following strotime but it converted the Y/d/m format to 1970-01-01
$date = date('Y-m-d h:i:s', strtotime($rows[$i][2]));
If by mistake month and date got swapped, can we save and display the same in Y-m-d format??