从Excel工作表中获取值作为PHP中的日期

从Excel工作表中获取值作为PHP中的日期,php,excel,phpexcelreader,Php,Excel,Phpexcelreader,我使用PhpExcelReader-- 包括“excel_reader.php”;//包括班级 // creates an object instance of the class, and read the excel file data $excel = new PhpExcelReader; 数据读取和函数调用-- 功能代码-- 功能表数据($sheet) { 而($xExcel中的日期字段是“1900年1月0日起的天数”,其中PHP中的时间是“1970年1月1日起的秒数00:00”。从

我使用PhpExcelReader--
包括“excel_reader.php”;//包括班级

// creates an object instance of the class, and read the excel file data
$excel = new PhpExcelReader;
数据读取和函数调用--

功能代码--

功能表数据($sheet)
{

而($xExcel中的日期字段是“1900年1月0日起的天数”,其中PHP中的时间是“1970年1月1日起的秒数00:00”。从那里进行转换应该非常容易。

使用此处详述的此函数

$excel->read('test.xls');
sheetData($excel->sheets[0]);
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/>";
            }
         }
     }
}
echo $cell = @date("Y-m-d",$cell)."<br/>";
$PHPDate = PHPExcel_Shared_Date::ExcelToPHP($cell);
echo date("Y-m-d", $PHPDate);