title: Retrieve data based on year and month in cakephp
body: <p>I am trying to create a get statements function and I have some problems defining the date range.</p>
  
  <p>The data will be passed via get method in the following format: <strong>?year=yyyy&amp;month=mm</strong> 
  The relevant column of the table has <strong>datetime</strong> type (<strong>2012-02-01</strong>).</p>
  
  <p>I checked the <strong>TimeHelper</strong> class and more particularly the <code>TimeHelper::daysAsSql($begin, $end, $fieldName, $timezone = NULL)</code> but i am not sure if it applies for this case.</p>
  
  <p>I was thinking if i can create a date in the format of Y-m using the two variables year and month and then use it in the conditions for retrieving the data but I am sure there is a more efficient and proper way. Could anyone help?</p>
  
  <pre><code>$user_id = $Client['Client']['id'];
      $year = $this-&gt;request['url']['year'];
      $month = $this-&gt;request['url']['month'];
      //$date_created = date('Y-m');
  
  
    if (!empty($user_id) &amp;&amp; (!empty($date_created))) {
  
  
          $Reports = $this-&gt;Report-&gt;find('all', array(
          'fields' =&gt; array('amount','currency','date_created','invoice_no'),
          'conditions' =&gt; array(
              'Report.client_id'=&gt; $user_id,
              'Report.date_created &gt;=' =&gt; $date_created, 
              'Report.date_created &lt;=' =&gt; $date_created
  
               ),
          )
      );
  </code></pre>