Active CodeIgniter record compares date

I have a column in db with a date stored as mm / dd / yyyy. I need to capture all rows with dates exceeding a certain date. (For example, any date after 01/01/2012). How to do this using active recording?

I tried

$this->db->select('DATE_FORMAT(date, '%mm/%dd/%Y') as mydate'); $this->db->where('mydate >','01/01/2013'); 
+4
source share
1 answer
 $this->db->select("DATE_FORMAT(date, '%m/%d/%Y') as mydate",FALSE); $this->db->from('table'); $this->db->where("DATE_FORMAT(date,'%Y-%m-%d') > '2013-01-01'",NULL,FALSE); 
+7
source

Source: https://habr.com/ru/post/1489574/


All Articles