This question already has an answer here:
I am using yii2 datepicker in my project. I want to show selected date as dd/mm/YYYY but want to save date in model as YYYY-mm-dd. How can I do so?
</div>
You can format datepicker in Controller,and then render the view.
Controller:
$model->birth_date=Yii::$app->formatter->asDate($model->birth_date, "dd/mm/yyyy");
Then Store like this:
$model->birth_date=Yii::$app->formatter->asDate($model->birth_date, "yyyy-mm-dd");