I’m using Kartik’s DetailView widget, but presumably this same issue would occur in the native Yii2 DetailView. In my table, I have a field named apointment_time. In one record in the database, the value stored in that field is 2017-05-16 09:00:00.
Within the column definitions for DetailView, I have the following two entries for the same attribute:
'apointment_time',
[
'attribute' => 'apointment_time',
'format' => ['datetime', 'php:m/d/Y g:i a'],
],
However, when these two are displayed in DetailView, here’s what they display:
Appt Time 2017-05-16 09:00:00
Appt Time 05/16/2017 11:00 AM
I can’t understand why the formatted time displays as two hours later than the database time and unformatted time. I’m have not configured formatter() with any settings.
Any ideas on how I might get this to work correctly?