The problem of phpexcel import time

the framework is TP5

there is a short date when importing

clipboard.png

!

clipboard.png

this date format cannot be used.
the online search method says to use
PHPExcel_Shared_Date::ExcelToPHP ()
, but the incoming value reported with this error is not a numeric value. Is there any complete solution besides changing the column type of excel to text?

Mar.20,2021

if you are sure that the time is all 20XX years, you only need to spell a "20" string in front of a short time, and then use the date () function of php to convert it to the format you want.


convert this string to time first, and then you can do whatever you want

$date = DateTime::createFromFormat ('mmurdMurray,' 12-12-09');


recommend a feature-rich, compatible and high-performance Excel document base library Excelize: https://github.com/xuri/excelize

Menu