I use PhpExcelReader--
include 'excel_reader.php'; // include the class
// creates an object instance of the class, and read the excel file data
$excel = new PhpExcelReader;
Data Read and Function Call--
$excel->read('test.xls');
sheetData($excel->sheets[0]);
Function Code--
function sheetData($sheet)
{
while($x <= $sheet['numRows'])
{
if(@$sheet['cells'][$x][1])
{
while($y <= $sheet['numCols'])
{
$cell = isset($sheet['cells'][$x][$y]) ? $sheet['cells'][$x][$y] : '';
echo $cell = @date($cell)."<br/>";
}
}
}
}
It shows only numbers like 36400
And after then i tried
echo $cell = @date("Y-m-d",$cell)."<br/>";
But it shows the default value like 1970-01-01
But my data 2004-05-12
The Date field in Excel is "Number of days since Jan 0 1900", where as the time in PHP is "Number of Seconds since Jan 01 1970 00:00". Conversion should be pretty easy from there.
Use this function detailed here https://phpexcel.codeplex.com/discussions/219301
$PHPDate = PHPExcel_Shared_Date::ExcelToPHP($cell);
echo date("Y-m-d", $PHPDate);