php - How to change the date format when sending data into the database? -


i using jquery full calendar show booking details. inserting date database in ("yyyy-mm-dd") format.

but when retrieve title value calendar using var title=$("#calendar").fullcalendar('getview').title; output "june 2015". later using these 2 days comparison. therefor need either send date database in "19 june 2015" format or convert title date value "06 2015".

if has clear idea me. hope problem clear. using codeignier , use following cotroller method send data database.

function add_reservation() {         $reservation_model = new reservation_model();         $reservation_service = new reservation_service();          $reservation_model->set_date_cal(trim($this->input->post('date', true)));        // $reservation_model->set_date(strtotime($this->input->post('date', true)));         $reservation_model->set_title(trim($this->input->post('selected_hall', true)));         $reservation_model->set_type(trim($this->input->post('selected_time', true)));         $reservation_model->set_description(trim($this->input->post('name', true)));         $reservation_model->set_advanced_payment_status(trim($this->input->post('optionsradios', true)));         //$reservation_model->set_advanced_payment_status(trim($this->input->post('no', true)));         $reservation_model->set_paid_amount(trim($this->input->post('paid_amount', true)));         $reservation_model->set_fax(trim($this->input->post('fax', true)));         $reservation_model->set_telephone_number(trim($this->input->post('telephone', true)));         $reservation_model->set_address(trim($this->input->post('address', true)));         $reservation_model->set_menu_no(trim($this->input->post('selected_menu_number', true)));         $reservation_model->set_menu_price_per_plate(trim($this->input->post('menu_price', true)));         $reservation_model->set_is_deleted('0');          $this->db->last_query();          echo $reservation_service->add_reservation($reservation_model);   } 

basically want change format of date sending database "19 june 2015"

don't change mysql format. change html or keep every thing same way , use javascript convert mysql format.

var title=$("#calendar").fullcalendar('getview').title; // "june 2015" var d = new date(title); var title = d.getfullyear() + "-" +( d.getmonth() + 1); // "2015-6" 

now, can compare. let me know, if looking else.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -