我有一個帶有日期時間變量的表,它的值類似於其格式爲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();