asked on
$date_of_birth = "";
if(isset($Row[4])) {
$date_of_birth = date('Y-m-d', strtotime($Row[4]));
}
In Excel file, the date format is: DD-MM-YYYY (31-12-1999). After upload, it reads: (1970-01-01). It appears it's not seen 31 as Day but Month.ASKER
var_dump($Row[4]); // see what's coming from Excel. It has to be a string in the dd-mm-yyyy format
$date_of_birth = DateTime::createFromFormat("d-m-Y", $Row[4]); // create a new datetime object
var_dump($date_of_birth);
$dob = $date_of_birth->format("Y-m-d"); // format the datetime object
var_dump($dob);
$query = "...";
ASKER
ASKER
ASKER
ASKER
ASKER
so for example how would you know whether "12/09/2018" is 12th September or 9th December !!Point. Thanks sir
Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.
TRUSTED BY
ASKER
Open in new window
or i should first use a variable like:Open in new window
then:Open in new window