Now try using:
1.-
$this->db->where('a.fecha >= "'.$date1.'"');
$this->db->where('a.fecha <= "'.$date2.'"');
2.-
$this->db->where('DATE(a.fecha)',$date2);
3.-
$this->db->where('a.fecha',date('Y-m-d',strtotime($date1))); ....
If directly in mysql I put:
SELECT * FROM 'entrada' where fecha >= "2018-07-14" and fecha <= "2018-07-14"
works perfectly for me, showing information.
I do not understand why it does not work for me using codeigniter in any way.