I'm using data from Excel2007 as parsed by PHPExcel, and dates come out as days since 1900. How can I convert to string of 'YYYY-MM-DD' (or anything similar)?
+3
A:
Something like this, should do the trick:
PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), 'YYYY-MM-DD');
silent
2010-06-07 09:11:31
+1
A:
Or use
$phpDate = PHPExcel_Shared_Date::ExcelToPHP($cell->getCalculatedValue());
to convert an Excel/PHPExcel date to a PHP date/timestamp, and then use standard PHP date() function for formatting
Mark Baker
2010-06-07 09:15:20