title: Need to fetch only year and month from the date
body: <p>Here my value inserted in to the table is like as follows,</p>
  
  <pre><code>`2017-01-01`,
  `2017-01-02`,
  `2017-01-03`,
  `2017-01-04`,
  `2017-01-05`,
  `2017-01-06`. 
  </code></pre>
  
  <p>i need to fetch only year and month from that,
  for that i used my code like this</p>
  
  <pre><code>public function present_report_by_empid($user_id = null,$date = null) 
   {
  
      $query='tbl_attendance.date_in';
      $this-&gt;db-&gt;where('tbl_attendance.attendance_status', 1);
      $this-&gt;db-&gt;where('tbl_attendance.user_id', $user_id);
      $this-&gt;db-&gt;where(date('Y-m',strtotime($query)), $date);
  
      return $this-&gt;db-&gt;count_all_results('tbl_attendance');
  }
  </code></pre>
  
  <p>My $date value is <code>2017-01</code> and when i gave like this am getting error like this 
  <code>SELECT COUNT(*) AS</code>numrows<code>FROM</code>tbl_attendance<code>WHERE</code>tbl_attendance<code>.</code>attendance_status<code>= 1 AND</code>tbl_attendance<code>.</code>user_id<code>= '1' AND</code>1970-01<code>= '2017-01'</code></p>