Hi can somebody tell me how to set phpexcel cell format to datetime if I have datatime in php variable? I use it this way but it is only string:
$list->setCellValueByColumnAndRow( ++$column, $row, $survey->task->closed->format(DateTimeUtils::DATE_FORMAT_NO_SPACES) );
EDIT:
Now I have this code:
$list->setCellValueByColumnAndRow( ++$column, $row, \PHPExcel_Shared_Date::PHPToExcel( $survey->task->closed ) )
->getStyle()->getNumberFormat()->setFormatCode(\PHPExcel_Style_NumberFormat::FORMAT_DATE_DDMMYYYY);
but it sets the cell format to number and date seems in result like float number 43098.4755671296
解决方案
It seems the fluent call getStyle() does not work and should be called getStyleByColumnAndRow() instead on excel sheet object.
$activeSheet->getStyleByColumnAndRow( $column, $ro