How to shorten the date?

Hello,

I am stuck on this, I have in my model:




public function behaviors()

{

    return [

        [

            'class' => TimestampBehavior::className(),

            'createdAtAttribute' => 'created_at',

            'updatedAtAttribute' => 'updated_at',

            'value' => new Expression('NOW()'),

        ],

    ];

}



Which returns:

2015-04-24 21:17:07.000000

But I need:

2015-04-24 21:17:07

How can I remove all the zero and dot using the rules please?




   public function rules()

    {

        return [

            [['name'], 'required'],

            [['created_at', 'updated_at'], 'safe'],

            [['name'], 'string', 'max' => 45]

        ];

    }



Thank you!

Ben

Ok Got it,

Only add to add this in the view





    <?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],


            'id',

            'name',

            'created_at:datetime',

            'updated_at:datetime',


            ['class' => 'yii\grid\ActionColumn'],

        ],

    ]); ?>




Thanks,

Ben