Time cell is displayed as string when value is bigger than 24:00

Topics: Developer Forum, User Forum
Oct 2, 2014 at 10:28 AM
i have i part of code that generate work duration of a developer for a task

PHPExcel_Cell::setValueBinder( new PHPExcel_Cell_AdvancedValueBinder() );
$excel->getActiveSheet()->setCellValue('D' . $row , task_duration($item_task->duration_plan) . ':00');
$excel->getActiveSheet()->getStyle('D' . $row)->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);

everything works fine when the value of time cell is under 24:00:00. But when it become higher than 24, format of the cell turn to string ('24:00:00) .

Anybody knows how to keep the format for the cell as string even when time value is bigger than 24 ?
Oct 2, 2014 at 10:51 AM
FORMAT_DATE_TIME3 is a time format code h:mm that displays time based on a 24-hour clock, values over 24 hours will roll over to the following day, so 16:00 + 16:00 will give 1 day and 08:00 rather than 32:00 as the time; but h:mm suppresses days, and you won't see an hours value greater than 24 hours

If you want the hours value to exceed 24 (for example if you are adding several times together to work out a total duration) you will need to use an appropriate number format mask like [hh]:mm. This format will show 32:00 as the value for 16:00 + 16:00.
Oct 2, 2014 at 11:16 AM
no , the problem is when the value is bigger than 24:00 , for example 25:00 , in my time cell it would be displayed not as a time value , 25:00 but like a string value ('25:00:00) .