I have date field in database having varchar datatype. Now I have to compare date with the current date but because of data type(varchar) result is not coming properly.
I don't want to change datatype in database so how can I query in codeigniter ?
In my database date is in this format 30/11/2015
My current query:
//here vd is table field(one column).
$cd = date('d/m/Y');//current date
$this->db->where("date_format(STR_TO_DATE(vd, '%d/%m/%Y'),'%d/%m/%Y') >",$cd); //comparing date with current date
$query =$this->db->get('warranty');
By using above query it is just comparing the date not month and year. So it is returning those record which date is greater than today's date.
But proper result is not coming....