DATE_FORMAT in CodeIgniter

The date_format() function returns a date formatted according to the specified format.

Let’s create a date_format() in where condition using codeigniter.

if(!empty($this->input->get('start_date')))
{
	$this->db->where('DATE_FORMAT(products.created_datetime,"%Y-%m-%d") >=',
		date('Y-m-d',strtotime($this->input->get('start_date'))));
}

Leave a Reply

Your email address will not be published. Required fields are marked *