Phpexcel correct reading of Excel table time
Using Phpexcel to read the Excel file, read out the time column appears 5 digits, not want to time (do not know why), search online a exceltime function can correctly convert the time
Brand website Construction: http://www.ucantech.com/
PHP code
Error_reporting (E_all);
Date_default_timezone_set (' Asia/shanghai ');
/** Phpexcel_iofactory */
Require_once '. /classes/phpexcel/iofactory.php ';
$inputFileName = ' 6081076641077444758.xls ';
$objReader = new Phpexcel_reader_excel5 ();
$objPHPExcel = $objReader->load ($inputFileName);
$sheet = $objPHPExcel->getsheet (0);
$highestRow = $sheet->gethighestrow (); Total number of rows obtained
$highestColumn = $sheet->gethighestcolumn (); Total number of columns obtained
$tempArray = Array ();
for ($j =2; $j <= $highestRow; $j + +) {
for ($k = ' A '; $k <= $highestColumn; $k + +) {
if ($k = = ' M ' | | $k = = ' o ')//m column and O column is time
$tempArray [] = Exceltime ($objPHPExcel->getactivesheet ()->getcell ("$k $j")->getvalue ());
Else
$tempArray [] = $objPHPExcel->getactivesheet ()->getcell ("$k $j")->getvalue ();
}
Print_r ($tempArray);
Unset ($tempArray);
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.