Open GoogleCodeExporter opened 8 years ago
I am having the same issue, and it's become extremely frustrating. Can someone
please help with this?
Original comment by da...@lemcoe.com
on 21 Aug 2012 at 3:48
I'm having the same problem. I saw the datatype is "adapted", and not the
standard Date-datatype... Help?
Original comment by philip.d...@gmail.com
on 17 Sep 2012 at 9:36
[deleted comment]
Hi, I'm a little late to this party but it looks like this issue is still open
and I have a solution for the those who need a quick and dirty fix.
I'm not sure why this happens but here is what happened in my case. I was
trying to parse an xls file created by Crystal Report software. Its an xls file
but the date was coming back mm/dd/yyyy instead of as a date...
If you open the script and go to line 1610(ish) there is a function called
_getCelDetails. Most likely your cel $type variable will be 'other'.
Excel formats the date as a number of days since 12-30-1899 basically you'll
get a number like 41XXX as the 'raw' data from the date column.
http://code.google.com/p/php-excel-reader/issues/detail?id=42 for more..
Here is my fix, I put this code in right before the return array in the
_getCelDetails function, you can do whatever...
if($type == 'other'){
if(is_numeric( $numValue ) && floor( $numValue ) != $numValue){
// echo " Decimal".$numValue."<br> ";
//this is time value, idk what to do with it and I don't need it but if it's in
decimal format it's date / time.
}else{
//it's not a decimal.....
$timestamp = ($numValue - 25565) * 86400; // (25565) Subtract date from dec
30, 1899 but strtotime wont parse dates before 1900 or 1970 depending on php
versions and what not. So this number is by hand and may need adjusting...
$string = date("m/d/Y", $timestamp);
}
}
This fixed it for my particular issue but it would not work for everyone, but
hopefully this gives you a starting point to make changes to suit your
particular needs until it's fixed properly. Edit: I endeded up just reusing the
code for the if($type = 'date'){ to format dates and times..
Original comment by binxa...@gmail.com
on 20 Aug 2013 at 4:33
Original issue reported on code.google.com by
j...@jay-pennington.com
on 23 Feb 2010 at 10:53