Yii2 View DateTime Format (d-m-Y H:i:s) But When Save/update in DB Change format to Y-m-d H:i:s

后端 未结 5 1527
礼貌的吻别
礼貌的吻别 2021-02-06 04:26

I\'m Using Kartik DateTimePicker Extension

field($model, \'Created\')->widget(DateTimePicker::classname(),[
        \'model\' => $model,
          


        
5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 05:26

     public function behaviors() {
            return [
                [
                    'class' => BlameableBehavior::className(),
                ],
                [
                    'class' => TimestampBehavior::className(),
                    'value' => date('Y-m-d H:i:s')
                ],
            ];
        }
    

提交回复
热议问题