title: Filtering invoice collection by created_at in magento
body: <p>I'm trying to find a way to filter the results of getInvoiceCollection in the function below:</p>
  
  <pre><code>// "eachInvoice" is each of the Invoice object of the order "$orders"
  if ($order-&gt;hasInvoices()) {
      foreach ($order-&gt;getInvoiceCollection() as $eachInvoice) {
          $invoiceIncrementId = $eachInvoice-&gt;getIncrementId();
      }
  }
  </code></pre>
  
  <p>Can adding the filter below to $order->getInvoiceCollection()</p>
  
  <pre><code> $order-&gt;getInvoiceCollection()
  -&gt;addAttributeToFilter('created_at', array(
      'from' =&gt; $from_date,
      'to' =&gt; $today, 
      'date' =&gt; true,));
  </code></pre>
  
  <p>So the entire function would be, is the correct way to do this, it doesn't seem like its right.</p>
  
  <pre><code>// "eachInvoice" is each of the Invoice object of the order "$orders"
      if ($order-&gt;hasInvoices()) {
      foreach ($order-&gt;getInvoiceCollection()$order-&gt;getInvoiceCollection()
      -&gt;addAttributeToFilter('created_at', array( 'from' =&gt; $from_date,
      'to' =&gt; $today, 'date' =&gt; true,)) as $eachInvoice) {
          $invoiceIncrementId = $eachInvoice-&gt;getIncrementId();
      }
  }
  </code></pre>
  
  <p>Whats the "correct way" to go about doing this?</p>