我有一个带有日期时间变量的表,它的值类似于其格式为2015-06-22 22:30:00.030
的记录。更改日期时间以便在codeigniter中进行比较
如何将日期时间转换为codeigniter中的日期格式,以便我可以将其与表单中输入的日期(不包括时间)进行比较?这是我的查询,这让我这个错误:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'As Date) > '%2015/05/31%' AND merchant_transactions.CAST(datetime As Date) < '%2' at line 7
$search_where = "merchant_transactions.CAST(datetime As Date) > '%".$from."%' AND merchant_transactions.CAST(datetime As Date) < '%".$to."%'";
$this->db->where($search_where);
return $this->db->get();