에서 내 눈금 보기 나는 이를 변경하는 열간 및 날짜를 사용 시간대
[
'format' => [
'class' => 'yii\i18n\Formatter',
'timeZone' => 'Asia/Singapore',
],
'attribute' => 'created_at',
'label' => 'Date',
'filter' => false,
'value'=> function($model, $key, $index, $column){ return Search::getDateTime($model); }, }
'format' => 'raw',
]
그런 다음에서 내 모델 검색이
public static function getDateTime($model) {
$date = Yii::$app->formatter->asDate($model->created_at);
$time = Yii::$app->formatter->asTime($model->created_at);
return Html::a($date, null, ['href' => 'javascript:void(0);', 'class' => 'btn btn-link p-0 rounded-0 tooltips', 'data-toggle' => 'tooltip', 'data-placement'=> 'bottom', 'title' => $time]);
}
나도 이 내에서 main.php 구성 요소
'formatter' => [
'class' => 'yii\i18n\Formatter',
'dateFormat' => 'php:j M Y',
'datetimeFormat' => 'php:d/m/Y h:i a',
'timeFormat' => 'php:H:i A',
'defaultTimeZone' => 'Asia/Singapore'
],
에서 내 데이터베이스 created_at
저장 다음과 같이 2021-11-22 11:28:16
UTC
어떻게 그것을 얻을 보여 올바른 시간 내에 기반 timezone? (아시아/싱가폴)
asDate()
고asTime()
? 기 때문에 모든 내 datetimes 에 저장된 데이터베이 날짜와 시간입니다.