Answer the question
In order to leave comments, you need to log in
Why does time lag in console applications?
Good afternoon. When calling a regular action that generates a record in the database and takes the current time, everything is OK, but when the same action is called from the console using the cron / console call method, the time of the generated record is 3 hours behind. basic template. I tried to add the formatter config to the console.php file components - it did not help.
Answer the question
In order to leave comments, you need to log in
You have set a timezone for the formatter component, you should set it for the application:
return [
....
'timeZone' => 'Europe/Moscow',
...
'components' => [
.....
]
];
\Yii::$app->timeZone = 'Europe/Berlin';
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question