I’m using a CDetailView, and trying to configure a date from a MySQL database using the CFormatter datetime method. How can I specify the format to convert the string to? I know I need to use dateFormat, but I don’t know where to specify this.
$this->widget('zii.widgets.CDetailView', array(
'data'=>$model,
'attributes'=>array(
'title', // title attribute (in plain text)
'owner.name', // an attribute of the related object "owner"
'description:html', // description attribute in HTML
array( // related city displayed as a link
'label'=>'City',
'type'=>'raw',
'value'=>CHtml::link(CHtml::encode($model->city->name),
array('city/view','id'=>$model->city->id)),
),
),
));
So, for my dates, this is what it looks like:
array( // display StDate using DateFormatter
'label'=>'Date',
'value'=>'Yii::app()->dateFormatter->formatDateTime($data->StDate,"short","")',
),