I have an array named $dataArray, i want to show all the array content in my View, but there's some problem when I echo the date. The error is:
date_format() expects parameter 1 to be DateTimeInterface, string given
Here's the code
foreach ($dataArray as $data){
echo '<tr align="center">';
echo '<td>';
echo CHtml::encode($data->first_name);
echo ' ';
echo CHtml::encode($data->last_name);
echo '</td>';
echo '<td>';
$date = ($data->join);
echo date_format($date,'Y/m/d');
echo '</td>';
echo '<td>';
echo CHtml::encode($data->last_login);
echo '</td>';
echo '<td>';
echo '</tr>';
}