I found the reason for this that is the date format from the Excel sheet was directly inserted into the date function in php.
So you got date("dd/i/yyyy",$columnvalue);
Which should have looked like date("d/m/Y",$columnvalue);
So what is needed is that it uses the correct value here by either forcing one correct value (I do not have use for multiple formats, consistent output is better). Or link each format from Excel to a PHP date format value.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
An example tour date spreadsheet that demonstrates the error.
Logged In: NO
Hi,
Had the same issue. Better use the raw cell datas (cellsInfo).
For a date type, it contains the number of days elapsed since
the Epoch (1900-01-01)
Logged In: NO
how would you go about using raw data from here?
for ($i = 1; $i <= $data->sheets[0]['numRows']; $i++) {
for ($j = 1; $j <= $data->sheets[0]['numCols']; $j++) {
echo $data->sheets[0]['cells'][$i][$j];
}
}
Logged In: YES
user_id=1420026
This is a crappy workaround for the wrong parse of
mm/dd/yyyy dates.
function createDate($numValue){
if ($numValue > 1){
$utcDays = $numValue - ($this->nineteenFour ?
Spreadsheet_Excel_Reader_utcOffsetDays1904 :
Spreadsheet_Excel_Reader_utcOffsetDays);
$utcValue = round($utcDays *
Spreadsheet_Excel_Reader_msInADay);
if ($this->curformat == "i/dd/yyyy"){
$this->curformat = "m/d/Y";
}
$string = date ($this->curformat, $utcValue);
$raw = $utcValue;
}else{
$raw = $numValue;
$hours = floor($numValue * 24);
$mins = floor($numValue * 24 * 60) - $hours * 60;
$secs = floor($numValue *
Spreadsheet_Excel_Reader_msInADay) - $hours * 60 * 60 -
$mins * 60;
$string = date ($this->curformat, mktime($hours,
$mins, $secs));
}
return array($string, $raw);
}
Logged In: NO
I found the reason for this that is the date format from the Excel sheet was directly inserted into the date function in php.
So you got date("dd/i/yyyy",$columnvalue);
Which should have looked like date("d/m/Y",$columnvalue);
So what is needed is that it uses the correct value here by either forcing one correct value (I do not have use for multiple formats, consistent output is better). Or link each format from Excel to a PHP date format value.