I am using PHP. I allow users to upload records using a csv file, which is directly inserted into MySql DB after checking the field contents to be non-empty, integer etc.
Is there a way to check if the date is in the correct format in the csv file before insertions? i used is_date() function but it doesn't seem to exist. i want to check the following:
1. if date field is in mm-dd-yyyy or mm/dd/yyyy (notice the separator), i want to change it to MySql format ie yyyy-mm-dd before inserting
2. if date field is in yyyy-mm-dd, then it should proceed with insertion.
MUST check that field is in MySql format & if not then if possible then change it to that before insertion. I need it all to be done using PHP. Can someone please help. Thanks in advance