Extjs Commander Extjs Commander - 1 year ago 79
PHP Question

Converting Digits into string

1) I have been working on fetching data from an excel sheet i can see on a cell written

but when i select it i see
column right at top ,when i fetch data from the .xls sheet using http://phpexcel.codeplex.com library version number 1.7.3 ,it is returning

can any body tell how to convert it to either
all the cells other than this one are reading correctly so there is no error in code.

2) Also Please tell how can i get a better tutorial for this library as one provided on this site is not very helpful or i am using wrong library.
thanks in advance

Answer Source

See answer to this question http://stackoverflow.com/questions/2988201/days-since-1900 or read section 3.2 (and specifically 3.2.3) in the not very helpful "PHPExcel Function Reference Developer Documentation" which describes exactly how to convert between Excel dates and PHP dates (or PHP date/time objects).

The function you're after is:

$PHPdateValue = PHPExcel_Shared_Date::ExcelToPHP($excelDateValue);


$PHPdateObject = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateValue);

There are links to a number of tutorials in a variety of languages on the documents section of the PHPExcel website. And in addition to the documentation, there's plenty of code examples in the /Tests subdirectory of the distribution

Example of returning a PHP date/time object: include 'PHPExcel.php';

$excelDateValue = 40482.0;
$dateObj = PHPExcel_Shared_Date::ExcelToPHPObject($excelDateValue);

echo $dateObj->format('Y-m-d H:i:s');


2010-10-31 00:00:00
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download