Open GoogleCodeExporter opened 9 years ago
I have same error (bug) on 2.21 version: all time columns (HH:MM) after reading
returns 02:00.
Also dump function returns 02:00 in all columns that have data in HH:MM format
Original comment by shade...@gmail.com
on 12 Aug 2010 at 1:49
I fix it!!! (Sorry for my bad english - i`m from ukraine)
First of all go to line 1527 excel_reader2.php and replace
'rectype' => $rectype,
to
'type' => $rectype,
After it i write small function in class Spreadsheet_Excel_Reader:
function dumptoarray_noformat($sheet=0) {
$arr = array();
for($row=1;$row<=$this->rowcount($sheet);$row++){
for($col=1;$col<=$this->colcount($sheet);$col++){
$val = trim($this->raw($row, $col, $sheet));
if ($val==''){$val = $this->val($row,$col,$sheet);}
$arr[$row][$col] = $val;
}
}
return $arr;
}
This function dump all values from excel document into array.
Now you can see results by typing:
$data = new Spreadsheet_Excel_Reader($file,true,'utf-8');
$my_arr = $data->dumptoarray_noformat();
echo "<pre>";
print_r($my_arr);
=====================
But now, all column values, that have data in HH:MM format - looks like
0.239583333333 or 0.659722222222 :)
Its a decimal value of a time.
To convert in into a normal format, use this command:
$test_val = "0.315972222222";
$normal_time = date('H:i', mktime(0,0,0)+86400*$test_val);
I hope that I have someone able to help
Original comment by shade...@gmail.com
on 12 Aug 2010 at 2:29
Original issue reported on code.google.com by
blockedm...@gmail.com
on 6 May 2010 at 8:57