📜  检查是否在 excel import php 代码示例中输入了有效的日期格式

📅  最后修改于: 2022-03-11 14:53:59.980000             🧑  作者: Mango

代码示例1
try {
  Date::excelToDateTimeObject(trim($row[5]))->format('Y-m-d');
} catch (\Exception $exception) {
  throw ValidationException::withMessages([
    'file' => "contains incorrect date format, should be in Y-m-d format"]
  ]);
}