<p>I think this should do it.</p>

<pre><code>{% for block in workshop.workshopSession.sessionDate('&gt;=' ~ now|date('Y-m-d')).limit(1) %}
</code></pre>

<p>If not you always can go with a "dirty" fix by just showing the <code>{% loop.first %}</code> </p>

CC BY-SA 3.0
2016-11-01T12:38:37.947Z
2016-11-01T12:38:37.947Z
Justin Dekkers
<p>I need to display a block from a matrix for the following week.</p>

<p>Basically the query I need to build is</p>

<pre><code>{% for block in workshop.workshopSession.where(sessionDate &gt; now).first() %}
</code></pre>

<p>I just can't quite get this to work and have been searching for a while. Perhaps I am just missing something obvious. There will be more than one entry with a date greater than "now" so I need to limit it to 1.</p>

<matrix><craft-pro>
How to get next entry by date in matrix block but limit to just 1
# How to get next entry by date in matrix block but limit to just 1

(Asked by: username_0 on 2016-10-31)

I need to display a block from a matrix for the following week.
Basically the query I need to build is
{% for block in workshop.workshopSession.where(sessionDate > now).first() %}

I just can't quite get this to work and have been searching for a while. Perhaps I am just missing something obvious. There will be more than one entry with a date greater than "now" so I need to limit it to 1.

**Tags:** matrix, craft-pro

---

## 1 answers

### Answer by username_1 on 2016-11-01. Score: 2 | Accepted answer

I think this should do it.
{% for block in workshop.workshopSession.sessionDate('>=' ~ now|date('Y-m-d')).limit(1) %}

If not you always can go with a "dirty" fix by just showing the {% loop.first %}


---

