The GridView displays UNIX TIMESTAMP taken from MySQL. The following parameter is used to display the column:

  [ 'attribute' => 'date', 'filter' => false, 'format' => ['date', 'php:dmY H:i'], ], 

For some reason, on the production server all of these columns are displayed with the amendment of +1 hour, despite the fact that the server, PHP and MySQL have a time zone - Moscow. On the test server, everything is ok. In this case, the date() function formats the time correctly. Why?

    2 answers 2

    This is a problem with the intl version of the ICU library for php. It is connected with the transfer of hours that was in Russia until 2012. If it is updated it will work correctly. You can also simply disable it in php.ini, but then some functions will not work related to international formatting.

      Try this:

       ['attribute' => 'date', 'value' => function ($value) { return \Yii::$app->formatter->asDatetime($value, "php:dmY H:i"); }], 
      • Made stupid: return date('dmY H:i', $model->date); works fine. Something overdone in yii2 - Mik