<p>Your criteria for the date updated was written in the wrong syntax. It should be:</p>

<p><code>$criteria-&gt;dateUpdated = '&gt; 2015-09-02';</code></p>

<p>You can also simplify the way you query your Element Criteria Model like so:</p>

<pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'affiliates';
$criteria-&gt;dateUpdated = '&gt; 2015-09-02';
$affiliates = $criteria-&gt;find();
</code></pre>

<p>Take a look at the <a href="https://craftcms.com/docs/plugins/working-with-elements">Working with Elements</a> documentation for more info.</p>

CC BY-SA 3.0
2016-09-13T08:30:36.370Z
2016-09-13T15:19:40.280Z
2016-09-13T15:19:40.280Z
Luke Pearce
<p>I need to get all the entries that were updated after a certain date, I tried a couple things, but it doesn't seem to work, does anyone know how I can accomplish this?</p>

<p>This seems wrong to me, but it doesn't throw any error, neither does it accomplish what I want.</p>

<pre><code>$criteria = craft()-&gt;elements-&gt;getCriteria(ElementType::Entry);
$criteria-&gt;section = 'affiliates';
$criteria-&gt;dateUpdated("&gt; '2015-09-02'");

$query = craft()-&gt;elements-&gt;buildElementsQuery($criteria);
$queryResults = $query-&gt;queryAll();

$affiliates = EntryModel::populateModels($queryResults);
</code></pre>

<plugin-development>
Getting Entries that were updated after a certain day?
# Getting Entries that were updated after a certain day?

(Asked by: username_0 on 2016-09-13)

I need to get all the entries that were updated after a certain date, I tried a couple things, but it doesn't seem to work, does anyone know how I can accomplish this?
This seems wrong to me, but it doesn't throw any error, neither does it accomplish what I want.
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section = 'affiliates';
$criteria->dateUpdated("> '2015-09-02'");

$query = craft()->elements->buildElementsQuery($criteria);
$queryResults = $query->queryAll();

$affiliates = EntryModel::populateModels($queryResults);

**Tags:** plugin-development


---

## 1 answers

### Answer by username_1 on 2016-09-13. Score: 6 | Accepted answer

Your criteria for the date updated was written in the wrong syntax. It should be:
$criteria->dateUpdated = '> 2015-09-02';
You can also simplify the way you query your Element Criteria Model like so:
$criteria = craft()->elements->getCriteria(ElementType::Entry);
$criteria->section = 'affiliates';
$criteria->dateUpdated = '> 2015-09-02';
$affiliates = $criteria->find();

Take a look at the Working with Elements documentation for more info.


---

