<p>My Craft 3 version is:</p>

<pre><code>{% set result = craft.entries()
    .section('events')
    .eventDate( ['and', '&lt;' ~ now|atom, '&gt;' ~ now|date_modify('-6 days')|atom ] )
    .results(':notempty:')
    .orderBy('eventDate desc')
    .limit(3)
    .with(['imageGallery'])
    .all()
%}
</code></pre>

<p>Note the extra <code>|atom</code> after the <code>date_modify('-6 days')</code></p>

CC BY-SA 4.0
2018-08-13T21:34:47.933Z
The [atom](https://docs.craftcms.com/v3/dev/filters.html#atom) filter would work too, so just simplified your example to use that. Also worth noting that [batch-setting parameters](https://docs.craftcms.com/v3/dev/element-queries/#setting-parameters) is still supported, though the chain syntax you’ve switched to is better (gives the query a chance to do normalization on the values).
Brandon Kelly
CC BY-SA 4.0
2018-08-14T07:47:33.293Z
I seem to remember being advised to use the batch setting method in preference in a past SE answer. This caused me some confusion switching my existing Craft 2 code to Craft 3 as all the example code uses the chain syntax.
Paul Frost
CC BY-SA 4.0
2018-08-14T11:53:03.297Z
It was faster to use the batch method in Craft 2; in Craft 3 it’s a wash either way.
Brandon Kelly
CC BY-SA 4.0
2018-08-13T20:58:25.293Z
2018-08-13T21:32:43.437Z
2018-08-13T21:32:43.437Z
Paul Frost
<p>After spending a lot of time solving this for myself I thought I'd share it.
In my Craft 2 template I had this query:</p>

<pre><code>{% set result = craft.entries({
    section: 'events',
    eventDate: ['and', '&lt;' ~ now.w3c(), '&gt; ' ~ now | date_modify('-6 days')],
    results: ':notempty:',
    order: 'eventDate desc',
    with: ['imageGallery'],
    limit: 3
}) %}
</code></pre>

<datetime><conditional><query>
How do multiple date queries differ between Craft 2 and 3
# How do multiple date queries differ between Craft 2 and 3

(Asked by: username_0 on 2018-08-13)

After spending a lot of time solving this for myself I thought I'd share it.
In my Craft 2 template I had this query:
{% set result = craft.entries({
    section: 'events',
    eventDate: ['and', '<' ~ now.w3c(), '> ' ~ now | date_modify('-6 days')],
    results: ':notempty:',
    order: 'eventDate desc',
    with: ['imageGallery'],
    limit: 3
}) %}

**Tags:** datetime, conditional, query

---

## 1 answers

### Answer by username_0 on 2018-08-13. Score: 3

My Craft 3 version is:
{% set result = craft.entries()
    .section('events')
    .eventDate( ['and', '<' ~ now|atom, '>' ~ now|date_modify('-6 days')|atom ] )
    .results(':notempty:')
    .orderBy('eventDate desc')
    .limit(3)
    .with(['imageGallery'])
    .all()
%}

Note the extra |atom after the date_modify('-6 days')

> **Comments:**
> **username_1**: The [atom](https://docs.craftcms.com/v3/dev/filters.html#atom) filter would work too, so just simplified your example to use that. Also worth noting that [batch-setting parameters](https://docs.craftcms.com/v3/dev/element-queries/#setting-parameters) is still supported, though the chain syntax you’ve switched to is better (gives the query a chance to do normalization on the values).  
> **username_0**: I seem to remember being advised to use the batch setting method in preference in a past SE answer. This caused me some confusion switching my existing Craft 2 code to Craft 3 as all the example code uses the chain syntax.  
> **username_1**: It was faster to use the batch method in Craft 2; in Craft 3 it’s a wash either way.  

---

