wonder why it is using that format and not '2021/03/28'
Are you doing something with locale
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello everybody,
from time to time I am getting this error in my feature tests:
SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2021-03-28 02:44:56' for column `laravel_test`.`products`.`created_at` at row 1 (SQL: insert into `products ` (`stock`, `created_at`) values (1, 2021-03-28 02:44:56))
The migration for this col looks like this:
$table->timestamps();
I am running this MariaDB version:
Server version: 10.6.4-MariaDB Homebrew
Is it correct, that the only way to manage this is to set strict to false in config/database.php:
'mysql' => [
'driver' => 'mysql',
// ...
'strict' => false,
// ...
],
I'd like to hear your opinions about that :-)
MariaDB and MySQL use the same date format YYYY-MM-DD HH:MM:SS.ffffff
The timestamp should be sent in as a string
INSERT INTO t VALUES (4, '2001-07-22 12:12:12');
Please or to participate in this conversation.