Quantcast
Channel: PHPExcel Forum Rss Feed
Viewing all articles
Browse latest Browse all 2707

New Post: How to read just a date from excel into MySql?

$
0
0

Ok, sorry for my bad english. So, just code. In your isDateTime test :

if (PHPExcel_Shared_Date::isDateTime($cell)) {
		$LeFormat=$cell->getParent()->getStyle($cell->getCoordinate())->getNumberFormat()->getFormatCode();echo'format : '.$LeFormat;switch($LeFormat){case'mm-dd-yy':echo'date only : '.PHPExcel_Style_NumberFormat::toFormattedString($Cell->getValue(),PHPExcel_Style_NumberFormat::FORMAT_DATE_YYYYMMDD2);break;case'h:mm':echo'time only : '.PHPExcel_Style_NumberFormat::toFormattedString($Cell->getValue(),PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);break;case'm/d/yy h:mm':echo'date and time : '.PHPExcel_Style_NumberFormat::toFormattedString($Cell->getValue(),'yyyy-mm-dd h:mm');break;default:echo'???';
		}	
		} else {//not a date and/or time

Each case value is from a quick test file, but the snippet display the recorded format, you can add/modify if needed.

The result is just displayed but you can store it in your $imp_data.


Viewing all articles
Browse latest Browse all 2707

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>