Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid datetime format: 1292 Incorrect datetime value - Laravel 5.2

Tags:

php

mysql

laravel

I'm getting this error when I insert these value into my database table:

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value:
'24/06/2017' for column 'registration_from' at row 1 
(SQL: insert into `campus_registrations` (`campus_major_class_id`, 
`registration_from`, `registration_to`, `testing`, `announcement`, 
`enrollment_from`, `enrollment_to`, `updated_at`, `created_at`) values (3, 
24/06/2017, 27/06/2017, 13/07/2017, 01/08/2017, 05/09/2017, 31/01/2018,
 2017-06-07 09:39:31, 2017-06-07 09:39:31))

Do I have to intiate the datetime first or what?

like image 741
goateee25 Avatar asked Jun 07 '17 09:06

goateee25


1 Answers

I got the same error while trying to register user from the vue js frontend to laravel backend API.

The solution was updating the mysql strict mode to false. If anyone knows the cons of this approach, please leave your comments!

//config/database.php
'mysql' => [
    'strict' => false,
]
like image 69
Ryan Dhungel Avatar answered Sep 28 '22 04:09

Ryan Dhungel