使用ajax处理将日期插入数据库时​​更改日期(CodeIgniter)

I'm using a CodeIgniter framework and uses jQuery and ajax to insert data from inputs. The problem is the date changes when I process it in ajax. Im using MySQL for the database and the data type is Date.

I've tried to change formats for the date because it might not be the same format.

Jquery/Ajax:

    $(document).on('submit', '#insertQL_form', function(event){
      event.preventDefault();
      var month = $('#datetimepicker1').val();
      var nameCompany = $('#nameCompany').val();
      var email = $('#email').val();
      var position = $('#position').val();
      var ojLink = $('#ojLink').val();
      var remarks = $('#remarks').val();
      var withTestTask = $('#withTestTask').val();
      var testTaskStatus = $('#testTaskStatus').val();
      var withInterview = $('#withInterview').val();
      var overallStatus = $('#overallStatus').val();
      alert(month);
      $.ajax({
        url:"<?php echo base_url() . 'home/insertQL'?>",
        method:'POST',
        data: new FormData(this),
        contentType:false,
        processData:false,
        success:function(data)
        {
            alert(data);        
        }
      });
    });

Controller Function:

    public function insertQL()
    {
         if($_POST["action"] == "Add")
         {
            $insert_data = array(
                'month' =>  date("Y-m-d",$this->input->post('month')),
                'nameCompany' => $this->input->post('nameCompany'),
                'email' => $this->input->post('email'),
                'position' => $this->input->post('position'),
                'ojLink' => $this->input->post('ojLink'),
                'remarks' => $this->input->post('remarks'),
                'withTestTask' => $this->input->post('withTestTask'),
                'testTaskStatus' => $this->input->post('testTaskStatus'),
                'withInterview' => $this->input->post('withInterview'),
                'overallStatus' => $this->input->post('overallStatus')
            );
            $this->load->model('QLModel');
            $this->QLModel->insert_crud($insert_data);
            echo 'Data Inserted';
         }
    }

1970-01-01 this date MySQL stores when it not able to convert given date to the specific format of the date in MySQL that is Year-month-day, Use this code to fix that issue,

    function mformat_date($date_string)
    {
            // Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a 
            // slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is
            // assumed.

            return strtotime(implode('-', array_reverse(explode('/', $date_string))));
   }

You should try this before inserting to your db.

$m = strtr($this->input->post('month'), '/', '-');

then insert it like this.

'month' =>  date('Y-m-d', strtotime($m)),

Let me know the result.