codeigniter - php excel reader date format getting 1970-01-30 for any input date given in excel sheet -
i'am getting date format 1970-01-30 input date given date in excel
there 2 fields having date format cells date given in excel showing 1970-01-30 output in echo
please can 1 me
this code public function clientfileupload($list_id){ $clientarr = array('client_name','client_nick_name', 'client_email','client_phone','client_address','client_location','contract_name','contract_description','contract_value','renewal_date','expiry_date','payment_mode'); $this->load->library('phpexcel'); $name = $_files["images"]["name"]; $filetype = explode(".",$name); $name = str_replace(' ', '',$name. "_" . time()); $abs = getcwd(); $path = $abs . "/upload/excelfiles/"; $pathfile = $path . $name; if (move_uploaded_file($_files["images"]["tmp_name"], $path . $name)) if($filetype[1] == 'xlsx') { $objreader = phpexcel_iofactory::createreader('excel2007'); $objreader->setreaddataonly(true); $objphpexcel = $objreader->load($pathfile); $objworksheet = $objphpexcel->getactivesheet(); $highestrow = $objworksheet->gethighestrow(); $highestcolumn = $objworksheet->gethighestcolumn(); // e.g 'f' $highestcolumnindex = phpexcel_cell::columnindexfromstring($highestcolumn); } else { $objphpexcel = phpexcel_iofactory::load($pathfile); $objworksheet = $objphpexcel->getactivesheet(); $highestrow = $objworksheet->gethighestrow(); $highestcolumn = $objworksheet->gethighestcolumn(); // e.g 'f' $highestcolumnindex = phpexcel_cell::columnindexfromstring($highestcolumn); } $notinserted = array(); ($row = 1; $row <= $highestrow; ++$row) { $arr = array(); ($col = 0; $col <= $highestcolumnindex - 1; ++$col) { if($col == 9 || $col == 10) { $rowname = date('y-m-d', phpexcel_shared_date::exceltophp($objworksheet->getcellbycolumnandrow($col, $row)->getvalue())); }else { $rowname = $objworksheet->getcellbycolumnandrow($col, $row)->getvalue(); } if ($row != 1) { $arr[$clientarr[$col]] = $rowname; } } } print_r($arr);exit; echo true; exit; }
can 1 me thank in advance
Comments
Post a Comment