The DB have record with birthdate. I want to select year from year dropdown for inserted DB date.
The DB will have birthdate in the format m/d/Y e.g.(08/15/1990).
I want to select year 1990 for above date in the edit form.
<?= $form->field($model, 'year')->dropDownList($year, array('prompt' => 'YYYY')); ?>
Please try following code.
I assumed that birth_date is the database field which have the date.
$model->year = date('Y', strtotime($model->birth_date));
Let me know if you still find any problem.