You need to manually convert them or use a mapper.
Can use the built in function to convert one of the date as so in the following example:
\PhpOffice\PhpSpreadsheet\Shared\Date::excelToDateTimeObject($collection->first()[4])
You can also use Carbon I think
Carbon::parse($collection->first()[4])
If you use a mapper you can define that beforehand and don't worry about it.
https://docs.laravel-excel.com/3.1/imports/mapped-cells.html
namespace App\Imports;
use Maatwebsite\Excel\Concerns\ToModel;
use Maatwebsite\Excel\Concerns\WithMappedCells;
use PhpOffice\PhpSpreadsheet\Shared\Date;
new Import implements WithMappedCells, ToModel
{
public function mapping(): array
{
return [
'timecellA' => 'A5',
'timecellB' => 'A6',
'timecellC' => 'A7',
'timecellD' => 'A8',
];
}
public function model(array $row)
{
return [
'timecellA' => Date::excelToDateTimeObject($row['timecellA'],
'timecellB' => Date::excelToDateTimeObject($row['timecellB'],
'timecellC' => Date::excelToDateTimeObject($row['timecellC'],
'timecellD' => Date::excelToDateTimeObject($row['timecellD'],
];
}
}