Answer the question
In order to leave comments, you need to log in
How to correctly display the date / time, taking into account the time zone?
The database stores the date/time of the post (field DATETIME).
Installed
in B.D. everything is written in GMT. I expect the formatter to increase the value from the DB by 3 hours.Yii::$app->formatter->timeZone = 'Etc/GMT+3';
// $message->mess_date = 2018-05-24 18:38:00
Yii::$app->formatter->asDatetime($message->mess_date, "php:d-m-Y H:i");
// Выводит 24-05-2018 15:38
// А я ожидаю: 24-05-2018 21:38
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question