我需要从Excel导入以下格式的电子表格:
25-09-2019 16:38:52
因此,我使用Laravel Excel插入此行,然后尝试使用Carbon的自定义格式:
$format = 'd-m-Y H:i:s';
$fecha = Carbon::createFromFormat($format, trim($row[0]));
但是,每次尝试导入时都会出现以下错误。
InvalidArgumentException: The separation symbol could not be found
The separation symbol could not be found
Unexpected data found.
The separation symbol could not be found
The separation symbol could not be found
Trailing data in C:\laragon\www\reportes\vendor\nesbot\carbon\src\Carbon\Carbon.php:910
Stack trace:
#0 C:\laragon\www\reportes\app\Imports\BginfoImport.php(28): Carbon\Carbon::createFromFormat('d-m-Y H:i:s', '43733.693657407')
我将行添加到受保护的$ dates数组中,但是也许我只是在做错什么。