Check and debug the value for the date in your controller that you're trying to insert in the database.
Which value is it? Your error is showing an empty string: ' '
Apr 22, 2024
3
Level 2
Invalid datetime format in MySQL
Hello my friends, o have this erreur from laravel Log when i valid a form has to input of date when i valid the form this erreur show from the back :
[previous exception] [object] (PDOException(code: 22007): SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '' at C:\Users\ASUS\Desktop\PFE_project\pfe-app\vendor\laravel\framework\src\Illuminate\Database\Connection.php:587)
[stacktrace]
but in front show me this erreur: 422 (Unprocessable Content) i thing this erreur because the type of the column in database not match to the form of the input this is the input code knowing that the format in database like this : "0001-01-01" this is the code of the input :
<input
type="date"
id="endedAt"
name="endedAt"
className="mt-1 block w-64 px-3 py-2 bg-white border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring focus:ring-indigo-500 focus:border-indigo-500"
required
/>
and this is the type in database:
$table->date('start_at')->change();
Please or to participate in this conversation.