I'm having problems outputting an excel with its date object. I'm using PHPExcel on Symfony. I performed an SQL that grabs data from the database in my Symfony controller. Then I did a for loop to iterate through each rows of data. However when I added in the value of a date, it gives me an error:
FatalErrorException: Error: Cannot use object of type DateTime as array in ...\Symfony\vendor\phpoffice\phpexcel\Classes\PHPExcel\Cell\DefaultValueBinder.php line 86
Here is my code:
$excel = new PHPExcel();
$excel->setActiveSheetIndex(0);
// ..etc
for($results as $result) {
// codes..
->setCellValue('H'.$i, $result['date'])
}
It's not allowing me to output the excel because of this. Should I be converting it to a string?