1. 返回值里设置格式
[
'attribute' => 'updatetime',
'label'=>'更新时间',
'value'=>
function($model){
return date('Y-m-d H:i:s',$model->updatetime);
},
'headerOptions' => ['width' => '170'],
],
2. 设置format
[
'attribute'=>'created_at',
'format'=>['date', 'php:Y-m-d'],
],
3. 在component配置里设置全局formatter
'components' => [
'formatter' => [ 'dateFormat' => 'dd.MM.yyyy', 'decimalSeparator' => ',', 'thousandSeparator' => ' ', 'currencyCode' => 'CNY', //货币单位 ], ],