Arrayhelper With Function

I have model with follow data:

ID DATE(timestamp)

1 12312342

2 21321312

I need view it in dropList, but before process (convert dates in clear view):

<select name="foobar">

<option value="1">1 June 2014</option>

<option value="2">2 June 2014</option>


I use

 echo Html::dropDownList(



            ArrayHelper::map(Parser::find()->all(), 'id', 'date'))  ?>

But I have

<select name="foobar">

<option value="1">123231232</option>

<option value="2">123123123</option>


How can I do it?



You may use the same approach as described for Yii 1.1


Parser model:

public function getFormattedDate(){

   return date('Y-m-d', $this->date);


Calling dropDownList(), replace ‘date’ with a ‘formattedDate’ .

Thanks. It works for me.