saiyalel
(Saiyalel)
1
Am trying to format the date from 2015-10-11 to Oct-11-2015
i tried both this
_search.php
1)<?= $form->field($model, Yii::$app->formatter->asDate($this->date_of_birth, ‘long’)) ?>
and
2)<?= $form->field($model, Yii::$app->formatter->asDate($this->date_of_birth, ‘php:MM-dd-yyyy’)) ?>
Whats the problem please
mdomba
(Maurizio Domba Cerin)
2
and what is the result you are getting?
for the format you specified php:
so you need to use the PHP date format - http://php.net/manual/en/function.date.php#refsect1-function.date-parameters
By that to get the month 3 letter code you need just one M not two as you wrote above
ajkosh
(Ajaykaushiksharma087)
3
Use yii date format in view
[
'attribute'=>'start_date',
'format'=>['Date','php:d-m-Y']
],