skip to Main Content

Uploading my laravel 8 app to server with PHP 8.1.1 and testing row inserting
I got error, which I do not have at my local server :

SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2022-06-21 14:49:54+00:00' for column 'updated_at' at row 1 (SQL: insert into `pages` (`name`, `slug`, `lang`, `languages`, `status`, `redirect_url`, `colors`, `updated_at`, `created_at`) values (2w2, hgfhgf, en, ["en"], 0, http://site.test/pages_redirect, {"main_color":"#3a57e8"}, 2022-06-21 14:49:54+00:00, 2022-06-21 14:49:54+00:00))

table is created with migration :

Schema::create('pages', function (Blueprint $table) {
    $table->id();
    ...
    $table->timestamps();
});

Model has no any timestamp definitions.
In .env I have :

timezone='UTC'

In config/app.php I also have :

'timezone' => 'UTC',

I can not get where "+00:00" is here in error description and how can it be fixed?

Additive info :
Php info on my server shows :

"Olson" Timezone Database Version   0.system
Timezone Database   internal
Default timezone    UTC

If in phpmyadmin to run :

SHOW VARIABLES where variable_name = 'time_zone'

I got values :

time_zone = SYSTEM

In the config/app.php I have hardcoded :

'timezone' => 'UTC',

Thanks!

2

Answers


  1. Is your server in a different timezone? Try setting timezone to

    timezone='UTC+0:00'
    

    and respectively

    'timezone' => 'UTC+0:00'
    
    Login or Signup to reply.
  2. you have to use yyyy/mm/dd h:mm format beacuse i had same error once and when i use that format it worked!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search