日期:2014-05-16  浏览次数:20535 次

用phpexcel导,入,中目前出现2个数据格式问题
发布出来 说有非法词组 只能截图了


------解决方案--------------------
include 'Plugin/PHPExcel/Classes/PHPExcel/IOFactory.php';
$excel = PHPExcel_IOFactory::load('2.xls');
$sheet = $excel->getActiveSheet();
echo $sheet->getCell('A1')->getValue(), ' ', $sheet->getCell('A2')->getValue();
5.9335552883783E+14 41728.732916667

读出来就是这样,该如何处理?
想想再说
------解决方案--------------------
先解决时间的问题

读出的时间是天数
excel 的日期是从 1900-01-01 开始计算的(php 是从 1970-01-01)
两者间有一个天数差 25569
时间是格林威治时间
所以有
$d = 25569;
$t = 24 * 60 * 60;
echo gmdate('Y-m-d H:i:s', (41728.732916667 - $d) * $t);
2014-03-30 17:35:24