我有一个使用PHP Excel读取 Excel 表格的 PHP 程序。excel表只有一列格式化为'yyyy-mm-dd hh-mm-ss'。
当我使用 Php Excel 阅读此 excel 表时,一切正常,直到我到达 2038 年以上的日期。
现在,我已经阅读了 2038 问题,我想我可能能够检测到它并在用户输入日期 >=2038 时向用户返回错误消息,但由于日期错误,我不能。
更糟糕的是,它们是作为有效日期出现的。
这是我尝试过的不同值的示例(这是读入 PHP 后的数组):
INPUT == Exactly as written in excel sheet
OUTPUT == The output the PHPExcel Reader returns in the array
OUTPUT DATE INPUT DATE
----------------------------------------------
2036-02-13 02:42:08 -- 2988-10-31 00:00:00
----------------------------------------------
2028-08-16 11:03:28 -- 2300-10-31 00:00:00
----------------------------------------------
1902-09-24 17:31:44 -- 2038-10-31 00:00:00
----------------------------------------------
2037-10-31 00:00:00 -- 2037-10-31 00:00:00
----------------------------------------------
输出似乎是完全随机的,但仍然是有效的日期。
我希望能够捕获 2038 年以上的日期以向用户返回消息。
我正在运行 PHP 32 位。
这是将其读入数组并打印出来的代码:
$objPHPExcel = PHPExcel_IOFactory::load ( $this->pathToExcelFile);
$sheetData = $objPHPExcel->getActiveSheet ()->toArray ( null, true, true, false );
print_r ($sheetData, true);
想法?