<p>You concatenate the strings <code>'&gt;='</code> and what is output from the <code>timeLimit</code> var (the same as <code>{{ timeLimit }}</code> does). So it gets concatenated to <code>'&gt;=2014-08-22'</code>.</p>

<p>You need to change two things. First add a space after the comparison operator and second, change the date output to include the time by using the <a href="http://twig.sensiolabs.org/doc/filters/date.html" rel="nofollow"><code>date</code></a> filter. I suggest to use  <code>'c'</code> as the value for the formatting parameter, as it returns the datetime ISO 8601 formatted.</p>

<pre><code>{% set timeLimit = now|date_modify('-2 min') %}

{# Get entries with `dateUpdated('&gt;= 2014-08-22T01:55:00+02:00')` #}
{% set updated = craft.entries.dateUpdated('&gt;= ' ~ timeLimit|date('c')) %}
</code></pre>

CC BY-SA 3.0
2014-08-21T23:43:00.497Z
2014-08-21T23:54:07.227Z
2014-08-21T23:54:07.227Z
carlcs
<p>I'm trying to grab all Entries that were updated after a given date and time.</p>

<p>It seems like I can grab all entries updated after a <em>date</em> using the following:</p>

<pre><code>{% set timeLimit = now | date_modify("-2 min") %}
{% set updated = craft.entries({ dateUpdated: '&gt;=' ~ timeLimit }).section('myChannel') %}
</code></pre>

<p>The problem is, that code doesn't actually seem to take time into account at all, just date. <code>timeLimit</code> in the above will always return something like <code>2014-08-21</code>.</p>

<entries><datetime>
Fetch all entries with dateUpdated after a given time
# Fetch all entries with dateUpdated after a given time

(Asked by: username_0 on 2014-08-21)

I'm trying to grab all Entries that were updated after a given date and time.
It seems like I can grab all entries updated after a date using the following:
{% set timeLimit = now | date_modify("-2 min") %}
{% set updated = craft.entries({ dateUpdated: '>=' ~ timeLimit }).section('myChannel') %}

The problem is, that code doesn't actually seem to take time into account at all, just date. timeLimit in the above will always return something like 2014-08-21.

**Tags:** entries, datetime

---

## 1 answers

### Answer by username_1 on 2014-08-21. Score: 2 | Accepted answer

You concatenate the strings '>=' and what is output from the timeLimit var (the same as {{ timeLimit }} does). So it gets concatenated to '>=2014-08-22'.
You need to change two things. First add a space after the comparison operator and second, change the date output to include the time by using the date filter. I suggest to use  'c' as the value for the formatting parameter, as it returns the datetime ISO 8601 formatted.
{% set timeLimit = now|date_modify('-2 min') %}

{# Get entries with `dateUpdated('>= 2014-08-22T01:55:00+02:00')` #}
{% set updated = craft.entries.dateUpdated('>= ' ~ timeLimit|date('c')) %}


---

