有时我无法使用$date
格式“yyyy-mm-dd”将 Excel 单元格数据格式化为日期(例如 2017-07-12)
if ($date != '') {
$t_date = PhpOffice\PhpSpreadsheet\Shared\Date::stringToExcel($date);
$sheet->setCellValueByColumnAndRow($column,$row, $t_date);
$sheet->getStyleByColumnAndRow($column,$row)->getNumberFormat()->setFormatCode(PhpOffice\PhpSpreadsheet\Style\NumberFormat::FORMAT_DATE_DDMMYYYY);
}