I’m trying to add a column to my gridview. I want the new column to contain the number of days since the value of a field in the table (startedDate).
So far, I’m calculating the number of days as follows:
$today = getdate();
$dayCount = $today->diff(‘startedDate’);
Is this the best way to calculate this value? How do I include the dayCount value in my grid? I’m new to Yii/PHP so I need lots of help. Thanks!
Here’s the ExCGridView widget call:
<?php $this->widget(‘ExCGridView’, array(
‘id’=>‘lessonInfo-grid’,
‘dataProvider’=>$model->search(),
‘rowCssClassExpression’=>’$data->actionNeeded ? "bold ". ($row%2 ? “even” : “odd”) : ($row%2 ? “even” : “odd”)’,
‘columns’=>array(
‘id’,
‘startedDate’,
‘student.studentEnrollment.classroom’,
‘student.studentEnrollment.classroom.teacher’,
‘student’,
‘lesson’
),
),
)); ?>