Yii , show different date format in cgridview

前端 未结 5 873
小鲜肉
小鲜肉 2021-01-11 10:43

I had following cgridview in Yii application, I want to change date format in value,

\'columns\'=>array(
        array(
                \'name\'=>\'Dat         


        
5条回答
  •  迷失自我
    2021-01-11 11:07

    I strongly suggest to create or alter the localization file of your target language, and refer it in your application instead of writing custom functions for it without centralizing the format. Please see https://www.yiiframework.com/doc/guide/1.1/en/topics.i18n

    // Refer our own locale file(s)
    Yii::app()->setLocaleDataPath(Yii::getPathOfAlias('application.shared').'/i18n/data/');
    

    For filtering on the localized date/datetime column in the gridview, please see my answer in a 'duplicate' question: https://stackoverflow.com/a/53759001/3090890

提交回复
热议问题