Answer the question
In order to leave comments, you need to log in
Datetime field overflow: 7 ERROR: date/time field value out of range?
Laravel 5.4
PostgreSQL 9.6
Migration code:
Schema::create('roles', function (Blueprint $table) {
$table->increments('id')->unsigned();
$table->string('name', 55)->unique();
$table->string('description', 255)->nullable();
$table->timestamps();
});
DB::table( 'roles' )->insert ( [
'name' => 'admin',
'created_at' => date( 'd-m-y h:m:s' )
] );
Answer the question
In order to leave comments, you need to log in
$now_date = date('Y/m/d h:i:s', time());
DB::table( 'roles' )->insert ( [
'name' => 'admin',
'created_at' => date($now_date)
] );
If you want to use the date in queries, for example, in the format "01/01/2019", then you can add the line to the postgresql config:
And the error will disappear =)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question