Javascript Ajax jQuery Html PHP Example Quiz New MORE

How to Change the Date format in jQuery Datatable AJAX call


It is always difficult to change the date format in jQuery Datatable AJAX call

So today I come with a very good and easy solution.

Model

$query = $this->db->select("IsFullAccess");
		$this->db->from('UserMst');
		$this->db->where($where);
		$query=$this->db->get();
		$result=$query->row();
		$data = $this->input->post();
        $keyword = trim($data["search"]["value"]);
		$query=$this->db->select("*");
		$this->db->from('houselr');
		$this->db->where('is_delete', 0);
		$this->db->order_by('auto_id', 'desc');
		if($this->session->userdata('IsAdmin')!=1 && $is_full_access!=1){
			$this->db->where('user_id',  (int)$this->session->userdata('AutoID'));
		}
        if(!empty($keyword)) {
			$this->db->group_start();
			$this->db->like('ref_no', $keyword);
			$this->db->group_end();
		}
		$this->db->limit($data['length']);
		$this->db->offset($data['start']);
		$query=$this->db->get();
		$lrList= $query->result();
		$lrList = json_decode(json_encode($lrList),true);
		foreach ($lrList as $key => $value) {
			$ExpectedDate =$value['ExpectedDate'];
			$newDate = date("Ymd", strtotime($ExpectedDate));
			if (!empty($newDate)) {
				$lrList[$key]['expecteddate'] = $newDate;
				
			}
		}
		$draw = $this->input->post('draw');
		$total = $this->db->where($where)->count_all_results('houselr');
		$totalFilter = count($lrList);
		$contents = array("msg"=>"data found",
			"data"=>$lrList,
			"draw"=>$draw,
			"recordsTotal"=>$total,
			"recordsFiltered"=>$total
		);