V
V
Vadim2018-08-07 07:32:02
Yii
Vadim, 2018-08-07 07:32:02

Global time zone in Yii2?

I use DateControl I
came across an incomprehensible thing:
my time zone is +6 in the base is +3. when viewing the record, it normally shows (I display it through the helper). and when editing in DateControl shows +3 and it turns out that the date is a day ago. i.e. when saving the date looks like Jul 30, 2018 12:00:00 AM and when editing Jul 29, 2018 9:00:00 PM
the DateControl has 'displayTimezone' => 'Etc/GMT+6', and 'saveTimezone ' => 'Etc/GMT+6' but they don't react either.
Is it possible to somehow set the global timezone in yii, except for 'formatter' => ['timeZone' => 'Etc/GMT+6'] because is it being ignored?
ps The date is very important in a project.
Googled everything, it doesn't help.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Bay, 2018-08-07
@Vadim-55

in config
'timezone'=> 'UTC',
and set your timezone in the formatter.

M
Maxim Fedorov, 2018-08-07
@qonand

In the application configuration, in the timeZone property

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question