<p>This code works - I double checked. I had a bug further down in my code.</p>

<pre><code>{% set fwd = entry.eventStartDate|date_modify('+30 min')|date('c') %}

{% set upcomingEvents = craft.entries
  .section('schedule')
  .order('eventStartDate asc')
  .eventStartDate('&gt; ' ~ fwd )
  .limit(5)
  .status('live, pending')
%}
</code></pre>

CC BY-SA 3.0
2017-02-28T21:19:26.597Z
2017-02-28T21:19:26.597Z
4midori
<p>Include an <code>and</code> in the date filter with a comma. When boiled down this is treaded as an array then converted to a SQL statement. </p>

<pre><code>{% set upcomingEvents = craft.entries
  .section('schedule')
  .order('eventStartDate asc')
  .eventStartDate('and', '&gt; ' ~ fwd )
  .limit(5)
  .status('live, pending')
%}
</code></pre>

CC BY-SA 3.0
2017-02-27T15:31:13.000Z
Hmm, that doesn't seem to work. I'm still getting events starting before the value of {fwd}.
4midori
CC BY-SA 3.0
2017-02-27T15:32:41.920Z
Try removing `|date('c')` from `fwd` eventStartDate.
a-am
CC BY-SA 3.0
2017-02-27T16:58:34.747Z
Still not working - is there a way to see the full query the Craft is running?
4midori
CC BY-SA 3.0
2017-02-27T17:03:12.993Z
If you have `devMode` turned on you can view in your JS console what craft is doing.
a-am
CC BY-SA 3.0
2017-02-27T20:40:08.437Z
Got it - what am I looking for?
4midori
CC BY-SA 3.0
2017-02-27T20:41:27.457Z
It will output a bunch of requests your looking for the SQL query that gives you the entries.
a-am
CC BY-SA 3.0
2017-02-27T20:43:00.173Z
Yes - there are tons of queries. I tried filtering on eventStartDate but I get a huge swath of info.
4midori
CC BY-SA 3.0
2017-02-28T21:17:28.473Z
Turns out I was displaying the wrong thing. The original code works! Where's the facepalm emoji?
4midori
CC BY-SA 3.0
2017-02-26T20:27:46.700Z
2017-02-26T20:27:46.700Z
a-am
<p>I have a bunch of entries with field eventStartDate and eventEndDate.</p>

<p>First I set the date</p>

<pre><code>    {% set fwd = entry.eventStartDate|date_modify('+30 min')|date('c') %}
</code></pre>

<p>When I output the value of fwd, it is <strong>2017-04-21T08:30:00-05:00</strong> </p>

<p>So that's 4/21/2017 at 8:30 AM</p>

<p>Then I query the channel to get events after that date/time</p>

<pre><code>{% set upcomingEvents = craft.entries
  .section('schedule')
  .order('eventStartDate asc')
  .eventStartDate('&gt; ' ~ fwd )
  .limit(5)
  .status('live, pending')
%}
</code></pre>

<p>I get events on 4/21/17 starting at 8:00AM, not what I intended.</p>

<p>Is my syntax wrong?</p>

<entries><datetime><filter>
Trouble getting entries after a certain date
# Trouble getting entries after a certain date

(Asked by: username_0 on 2017-02-24)

I have a bunch of entries with field eventStartDate and eventEndDate.
First I set the date
    {% set fwd = entry.eventStartDate|date_modify('+30 min')|date('c') %}

When I output the value of fwd, it is 2017-04-21T08:30:00-05:00 
So that's 4/21/2017 at 8:30 AM
Then I query the channel to get events after that date/time
{% set upcomingEvents = craft.entries
  .section('schedule')
  .order('eventStartDate asc')
  .eventStartDate('> ' ~ fwd )
  .limit(5)
  .status('live, pending')
%}

I get events on 4/21/17 starting at 8:00AM, not what I intended.
Is my syntax wrong?

**Tags:** entries, datetime, filter


---

## 2 answers

### Answer by username_0 on 2017-02-28. Score: 2 | Accepted answer

This code works - I double checked. I had a bug further down in my code.
{% set fwd = entry.eventStartDate|date_modify('+30 min')|date('c') %}

{% set upcomingEvents = craft.entries
  .section('schedule')
  .order('eventStartDate asc')
  .eventStartDate('> ' ~ fwd )
  .limit(5)
  .status('live, pending')
%}


---

### Answer by username_1 on 2017-02-26. Score: 0

Include an and in the date filter with a comma. When boiled down this is treaded as an array then converted to a SQL statement. 
{% set upcomingEvents = craft.entries
  .section('schedule')
  .order('eventStartDate asc')
  .eventStartDate('and', '> ' ~ fwd )
  .limit(5)
  .status('live, pending')
%}

> **Comments:**
> **username_0**: Hmm, that doesn't seem to work. I'm still getting events starting before the value of {fwd}.  
> **username_1**: Try removing `|date('c')` from `fwd` eventStartDate.  
> **username_0**: Still not working - is there a way to see the full query the Craft is running?  
> **username_1**: If you have `devMode` turned on you can view in your JS console what craft is doing.  
> **username_0**: Got it - what am I looking for?  
> **username_1**: It will output a bunch of requests your looking for the SQL query that gives you the entries.  
> **username_0**: Yes - there are tons of queries. I tried filtering on eventStartDate but I get a huge swath of info.  
> **username_0**: Turns out I was displaying the wrong thing. The original code works! Where's the facepalm emoji?  

---

