title: Reading date from uploaded Excel file
body: <p>I am uploading an Excel file through PHP Excel. The column C has dates in format mm/dd/yyy. </p>
  
  <p>When I echo the date for example '10/3/2016' it reads it as 42646. The format set for the column is short Date.</p>
  
  <p>How can I read it as the normal date instead of 42646. </p>
  
  <p>here is the model</p>
  
  <pre><code>function fi_upload($file_name){
  $file = './uploads/'.$file_name;
  $this-&gt;load-&gt;library('excel');
  $objPHPExcel = PHPExcel_IOFactory::load($file);
  $cell_collection = $objPHPExcel-&gt;getActiveSheet()-&gt;getCellCollection();
  foreach ($cell_collection as $cell) {
      $column = $objPHPExcel-&gt;getActiveSheet()-&gt;getCell($cell)-&gt;getColumn();
      $row = $objPHPExcel-&gt;getActiveSheet()-&gt;getCell($cell)-&gt;getRow();
      $data_value = $objPHPExcel-&gt;getActiveSheet()-&gt;getCell($cell)-&gt;getValue();
  
      if ($row == 1) {
          $header[$row][$column] = $data_value;
      } else {
          $arr_data[$row][$column] = $data_value;
      }
  }
  $data['header'] = $header;
  $data['values'] = $arr_data;
  $datecell = $objPHPExcel-&gt;getActiveSheet()-&gt;getCell('P2');
  if(PHPExcel_Shared_Date::isDateTime($datecell)) {
       $InvDate = date($format="Y-m-d", PHPExcel_Shared_Date::ExcelToPHP($datecell)); 
  }
  echo $InvDate;
  exit();
  
  
  foreach ($arr_data as $q){
  echo $q['C']; // column of date, date is echoed as 42646
  exit(); //here i exit to display the date
  }
  </code></pre>
  
  <p>I have to later insert it in the database as well in the yyyy/mm/dd format (which I can do if it is read properly)</p>
  
  <p>Thanks.</p>
  
  <p>UPDATE:</p>
  
  <p>So apparently it was an Excel file issue, not php. Converting the cell values through TEXT() was the solution as suggested by @Hallur.</p>
  
  <p>UPDATE 2.0:
  I am trying to do it via PHPEXCEL method but I get the following two issues.</p>
  
  <ol>
  <li>: Object of class PHPExcel_Cell could not be converted to int</li>
  <li>Echoes date as 2036-02-07 where as the date in cell is 10/4/2016</li>
  </ol>