Sunday, 15 May 2011

php - How to change default insertion of date format in mysql to d M yy? -



php - How to change default insertion of date format in mysql to d M yy? -

here's date format using insert database , in front end end displaying same. want alter in front end end d m yy format.

$postedon = date('y-m-d',strtotime($this->input->post('postedon')));

output posted on : 2014-06-01

here date inserting , displaying 2014-06-01.... but, if alter date format this

$postedon = date('d m yy',strtotime($this->input->post('postedon')));

it inserting 0000-00-00.

so please guide me how alter format of date.

you can build 2 functions date, store in database , display

here's example

function us_date_formate_to_mysql($date){ $date = str_replace("'", "", $date); $date = explode("/",$date); homecoming $date = $date[2]."-".$date[0]."-".$date[1]; }

arrange date want show or save in system.

hope work you.

php mysql codeigniter

No comments:

Post a Comment