PHP Instance-yii 2.0 Example of format time method in grid

Source: Internet
Author: User
Tags yii
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.