This article is mainly to share with you the YII 2.0 in the grid format time of the relevant data, the text gives a detailed sample code for everyone to reference the study, for everyone has a certain reference value, the need for friends below to see it together.
This article mainly introduces to you about Yii 2.0 in the grid format time of the relevant content, share out for everyone to refer to the study, the following to see the detailed introduction:
Directly on the code
<?= gridview::widget ([ ' dataprovider ' + = $dataProvider, ' columns ' = = [' Class ' = ' yii\grid\ ' Serialcolumn '], ' id ', ' username ', ' email:email ', ' created_at:date ',//These two need to be shown as 2016.04.10 ' updated_at:date ',//using:D ate To format the time [' class ' = ' Yii\grid\actioncolumn '],],?>
When you use the :date
format time, you will find that the time shown is English, okay, we can configure
In main.php, add a few lines to the components.
' Components ' = [ ' formatter ' and ' = ' dateformat ' and ' YYY '. Mm.dd ', ' decimalseparator ' = ', ', ' thousandseparator ' = ', ' currencycode ' = ' EUR ' , ', '
Summarize