Get result between two dates using DateFormat in Codeigniter is very simple. I will give the example of code that code you can use in your the model.
public function getResult($start_month,$end_month,$select_year){ $qry=$this->db->select('*')->from('Table Name') ->where("DATE_FORMAT(add_date,'%m') BETWEEN '$start_month' AND '$end_month' ") ->where('DATE_FORMAT(add_date,"%Y")',$select_year)->get()->result(); return $qry; }
Question and answer is powered by AnsPress.io