php - Date stored in excel becomes a number while reading and storing in mysql -
this question has answer here:
i'm using script read data excel file , store in mysql database table. it's working fine except field 'date' store in excel in "mm-dd-yy" format. problem "02/26/2014" becomes "41696" when comes php..
i want store field in "mm-dd-yy" format in mysql database table..
how can fix this? highly appreciated.. in advance.
what formatting date date
function , convert string strtotime
?
something like:
$str = '02/26/2014'; $date = date('y-m-d h:i:s',strtotime($str)); echo $date;
this output:
2014-02-26 00:00:00
in case need use function in different way:
$str = '02/26/2014'; $date = date('m-d-y',strtotime($str)); echo $date;
this output instead:
02-26-2014
this way dates ready stored in db.
anyway seeing how import excel data out.
Comments
Post a Comment