how to upload date from excel to mysql ? (using php)
<p>I am trying to upload few data from excel to mysql i am using php. When i upload date 5/14/2015 it could not upload properly. It went this format 1970-01-01. I am very tired to search in google.</p>

<p>Here is my code.</p>

<pre><code>if ($ext == 'xlsx' || $ext == 'xls') {
                            try {
                                $inputFileType = PHPExcel_IOFactory::identify($target_path);
                                $objReader = PHPExcel_IOFactory::createReader($inputFileType,'CSV');
                                $objReader-&gt;setReadDataOnly(true);
                                $objPHPExcel = $objReader-&gt;load($target_path);
                            } catch (Exception $e) {
                                die('Error loading file "' . pathinfo($target_path, PATHINFO_BASENAME) . '": ' . $e-&gt;getMessage());
                            }
                            $sheet = $objPHPExcel-&gt;getSheet(0);
                            $highestRow = $sheet-&gt;getHighestRow();
                            $highestColumn = $sheet-&gt;getHighestColumn();
                        }else{
                             //In case of CSV
                            if (($handle = fopen($target_path, "r")) !== FALSE) {
                                while (($data = fgetcsv($handle)) !== FALSE) {
                                    $csvData[] = $data;
                                }
                                fclose($handle);
                                $highestRow = count($csvData);

                            }
                        }

                        $rowData = array();
                        for ($row = 2; $row &lt;= $highestRow; $row++) {
                            if ($ext == 'xlsx' || $ext == 'xls') {
                                //  Read a row of data into an array
                                $test = $sheet-&gt;rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
                                $rowData[] = $test[0];

                            }
                        }



                        if ($ext == 'csv') {
                            $rowData = $csvData;
                        }
                        $variable = array();
                        $i = 0;
                        $targetArr = array();
                        $error = '';
                        foreach($rowData as $item){
                            if($item[0] !='' &amp;&amp; $item[1] !='' &amp;&amp; $item[2] !=''):
                                $variable[$i]['Customer'] = array();
                                $variable[$i]['Customer']['msisdn'] = $item[0];
                                $variable[$i]['Customer']['csactivated'] = date('y-m-d',strtotime($item[1]));
                                $variable[$i]['Customer']['csdeactivated'] = date('y-m-d',strtotime($item[2]));
                                //$targetArr[] = $variable;
                                $i++;
                            else:
                                $count =+1;
                                $error .= 'Skip this Row'.$i++.'&lt;br&gt;';
                                continue;
                            endif;
                        }
</code></pre>

<p>i got date like 42104.592743056 when i import excel though it is not my date format .........and mysql insert like 1970-01-01</p>