Hi, i am using basic template.
'timeZone' => 'Asia/Kuala_Lumpur',
in my config/web
'timestamp' => [ 'class' => 'yii\behaviors\TimestampBehavior', 'attributes' => [ ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'], ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'], ], ],
in my class.
I has a form that using kartik timepicker for user to select time. This time stored in database in time datatype.
Problem is when i display the stored time with format time, it will show in different time than what is stored in database. My timestamp for created at and updated at show the right time when i use datetime format.
If i do
$formatter->timeZone = 'UTC'
the time display will be correct, but the timestamp created at and updated will be wrong.
Please explain why it happen and the solution?