I have a PHP code that will export an array of data to excel. It is working fine but the formatting isn't working on the output. For example, I have an array value of 0:13:00
(it is in 24 hour format). What I want is to format it in excel to [mm]:ss
so the output should be 13:00
after the export but the value remain as it is while when I look on the cell formatting in excel, the format is already in [mm]:ss
. I also tried changing the value to 12 hour format (12:13:00 AM
) but it also remain as it is after export. Can someone help me with this please.
Here is my code in formatting the cell using PHPExcel.
$sheet = $objPHPExcel->getActiveSheet();
$sheet->getStyle('C3:N199')->getNumberFormat()->setFormatCode('[mm]:ss');