I need to compare dates within a query, the date is stored in the database like d-m-y (24-Mar-11) and I need to convert it to Ymd (20110324).
This is what my query looks like, I need to convert the C.SP_COMMENTS_ACTIVITY_DATE to Ymd
Is it possible to do this at run time or do I need a separate function to capture that value then convert it before running this query?
return $this->db
->distinct()
->select('*')
->from('SP_COMMENTS C')
->where('C.SP_COMMENTS_USERNAME', $user)
->where('C.SP_COMMENTS_YEAR_CODE', $year_code)
->where('C.SP_COMMENTS_ACTIVITY_DATE >=', date("Ymd", strtotime($this->input->post('user_begin_date'))))
->where('C.SP_COMMENTS_ACTIVITY_DATE <=', date("Ymd", strtotime($this->input->post('user_end_date'))))
->get(开发者_高级运维)
->result_object();
->where('DATE(C.SP_COMMENTS_ACTIVITY_DATE, "%Y%m%d") >=', date("Ymd", strtotime($this->input->post('user_begin_date'))))
精彩评论