title: php/Codeigniter-- How to compare only date by excluding time
body: <p>i have a field in my db table as <code>creater_date</code> as datetime and having values stored in the form of <code>2013-09-13 02:12:44</code></p>
  
  <p>Now i have to compare today-date(no time) with  <code>creater_date</code>  table  field .</p>
  
  <p>I tried this below code but it is showing error : </p>
  
  <pre><code> function check_existing_User_weightStatus($u_id)
   {
      $this-&gt;load-&gt;database();
      $this-&gt;load-&gt;helper('date');  
      $today = date('Y-m-d');
      $array = array('creater_id' =&gt; $u_id,DATE('created_date') =&gt; $today);
      $this-&gt;db-&gt;where($array); 
      $query = $this-&gt;db-&gt;get('user_weight');
      if ($query-&gt;num_rows() &gt; 0) {
          return true;
      } else {
          return false;
      } 
   }
  </code></pre>
  
  <p><strong>Getting error :</strong></p>
  
  <pre><code> A Database Error Occurred
  
   Error Number: 1064
  
   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 '13 Sep 2013 02:48:27 +0530Asia/Calcuttaam30Asia/Calcutta13_13am30Asia/Calcutta '' at line 4
  
   SELECT * FROM (`user_weight`) WHERE `creater_id` = '3235' AND `2013-09-13T02:48:27+05:30Fri,` 13 Sep 2013 02:48:27 +0530Asia/Calcuttaam30Asia/Calcutta13_13am30Asia/Calcutta '2013-09-13'
  
   Filename: D:\xampp\htdocs\webapp\system\database\DB_driver.php
  
   Line Number: 330
  </code></pre>
  
  <p><em>i do not want to compare with the time , i only want to comapare with the today date.    The field <code>created_date</code>(eg. 2013-09-13 02:12:44)  is having <code>datetime</code> datatypes with some time values. But i want to compare only with the date</em></p>