我想在网络中输出我的 excel 文件中的数据。excel 中的一个单元格被格式化为日期,并在输出时返回如下:
A000001 | John Doe | DR | 41456 | 41465<-- // this should be date
A000002 | Philip Moris | CP | 41456 | 41465 // formatted as yyyy-mm-dd
require_once("controller/xls/Classes/PHPExcel/IOFactory.php");
$objPHPExcel = PHPExcel_IOFactory::load($filer);
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet)
{
$worksheetTitle = $worksheet->getTitle();
$highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
$nrColumns = ord($highestColumn) - 64;
echo '<table>';
for ($row = 5; $row <= $highestRow; ++ $row)
{
echo '<tr>';
for ($col = 1; $col < $highestColumnIndex; ++ $col)
{
$cell = $worksheet->getCellByColumnAndRow($col, $row);
$val = $cell->getValue();
echo '<td>'.$val.'</td>';
}
echo '</tr>';
}
echo '</table>';
}
现在是unix时间吗?如果是这样,当我使用 getCellByColumnAndRow 时如何格式化它?我还将它存储在 mysql db 中。肿瘤坏死因子。