TIMEVALUE

Converts a time in the form of text to a serial number.

getActiveSheet(); // Add some data $testDates = array( '3:15', '13:15', '15:15:15', '3:15 AM', '3:15 PM', '5PM', '9:15AM', '13:15AM' ); $testDateCount = count($testDates); for($row = 1; $row <= $testDateCount; ++$row) { $worksheet->setCellValue('A'.$row, $testDates[$row-1]); $worksheet->setCellValue('B'.$row, '=TIMEVALUE(A'.$row.')'); $worksheet->setCellValue('C'.$row, '=B'.$row); } $worksheet->getStyle('C1:C'.$testDateCount) ->getNumberFormat() ->setFormatCode('hh:mm:ss'); echo '
'; // Test the formulae ?> '; echo ''; echo ''; echo ''; echo ''; echo ''; } ?>
Time String Formula Excel TimeStamp Formatted TimeStamp
' , $worksheet->getCell('A'.$row)->getFormattedValue() , '' , $worksheet->getCell('B'.$row)->getValue() , '' , $worksheet->getCell('B'.$row)->getFormattedValue() , '' , $worksheet->getCell('C'.$row)->getFormattedValue() , '