Answers.Body: <p>Would this do it?</p>
  
  <pre><code>{% set blocks = entry.matrixFieldHandle %}
  {% for block in blocks if block.yourDateField|date &gt;= now|date %}
  
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-12T09:51:43.143Z
Answers.LastActivityDate: 2014-06-12T09:51:43.143Z
Answers.UserDisplayName: Espen Sandberg
Answers.Body: <p>Here’s how you would do that:</p>
  
  <pre><code>{% set futureEvents = entry.myMatrixField.myDateField('&gt;= '~now) %}
  
  {% for event in futureEvents %}
      {{ event.description }}
  {% endfor %}
  </code></pre>
  
  <p><strong>Update:</strong></p>
  
  <p>This actually hadn’t worked as I expected to, but it does as of Craft 2.3.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-21T15:44:20.643Z
Answers.Text: Should this technique work with any matrix field, I have a matrix block which has a field which holds a section ID but `{% set pub = globalPubSettings.pubSettings.pubId(entry.section.id) %}` is throwing a method not found for pubId?
Answers.UserDisplayName: Sam Hibberd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-05T08:44:42.023Z
Answers.Text: I have the same problem as Sam Hibberd, this method throws a CException "no method or closure with the name 'myDateField'".
Answers.UserDisplayName: Florian
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-05T14:42:33.967Z
Answers.Text: @BrandonKelly Is there a solution for this, just revisting and hoping I can get `{% set var = page.matrixField.showOnHome('1') %}` to work. Still throwing the same exception.
Answers.UserDisplayName: Sam Hibberd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-05T23:34:17.667Z
Answers.Text: @SamHibberd Turns out I lied - we never got custom field-based parameters working for Matrix fields. I’ve spent the better part of the day trying to refactor some code to get it working, but unfortunately it’s looking like it won’t be possible without a breaking change to element types :-/  Stashed my work for now, and we’ll just have to revisit this for Craft 3.0.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-06T10:58:39.497Z
Answers.Text: @BrandonKelly :) Is there a snappy way to determine if a field is set, would search work?
Answers.UserDisplayName: Sam Hibberd
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-07T00:54:22.280Z
Answers.Text: @SamHibberd Search wouldn’t work here, no. After talking the problem over with Brad at the end of the day yesterday, I realized there was a way we could get it working before 3.0 without breaking existing element types (or at least making them any more broken then they already are in this case). Spent the day working on this, and am happy to report I’ve just gotten it all working for 2.3.
Answers.UserDisplayName: Brandon Kelly
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-11-15T14:51:51.140Z
Answers.Text: Does this work for you now or does it not, @Clive? Or are you already on 2.3?
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-12T10:33:37.997Z
Answers.Text: This method is would less of an performance impact than using a conditional to determine whether or not to display the entry in a for loop.
Answers.UserDisplayName: Steve Adams
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-06-12T09:40:25.573Z
Answers.LastActivityDate: 2014-12-18T03:14:35.107Z
Answers.LastEditDate: 2014-12-18T03:14:35.107Z
Answers.UserDisplayName: Clive Portman
Body: <p>I have a matrix field with one "event" block type that contains several fields. One of those fields is a date field. Is there a way to get just blocks with upcoming dates?</p>
  
Tags: <matrix><date><search>
Title: Search matrix for blocks with upcoming dates
ThreadText: # Search matrix for blocks with upcoming dates
  
  (Asked by: username_0 on 2014-06-12)
  
  I have a matrix field with one "event" block type that contains several fields. One of those fields is a date field. Is there a way to get just blocks with upcoming dates?
  
  **Tags:** matrix, date, search
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2014-06-12. Score: 13 | Accepted answer
  
  Here’s how you would do that:
  
  ```
  {% set futureEvents = entry.myMatrixField.myDateField('>= '~now) %}
  
  {% for event in futureEvents %}
      {{ event.description }}
  {% endfor %}
  
  ```
  
  **Update:**
  
  This actually hadn’t worked as I expected to, but it does as of Craft 2.3.
  
  > **Comments:**
  > **username_7**: This method is would less of an performance impact than using a conditional to determine whether or not to display the entry in a for loop.  
  > **username_3**: Should this technique work with any matrix field, I have a matrix block which has a field which holds a section ID but `{% set pub = globalPubSettings.pubSettings.pubId(entry.section.id) %}` is throwing a method not found for pubId?  
  > **username_4**: I have the same problem as Sam username_3, this method throws a CException "no method or closure with the name 'myDateField'".  
  > **username_3**: @username_5 Is there a solution for this, just revisting and hoping I can get `{% set var = page.matrixField.showOnHome('1') %}` to work. Still throwing the same exception.  
  > **username_5**: @username_3 Turns out I lied - we never got custom field-based parameters working for Matrix fields. I’ve spent the better part of the day trying to refactor some code to get it working, but unfortunately it’s looking like it won’t be possible without a breaking change to element types :-/  Stashed my work for now, and we’ll just have to revisit this for Craft 3.0.  
  > **username_3**: @username_5 :) Is there a snappy way to determine if a field is set, would search work?  
  > **username_5**: @username_3 Search wouldn’t work here, no. After talking the problem over with Brad at the end of the day yesterday, I realized there was a way we could get it working before 3.0 without breaking existing element types (or at least making them any more broken then they already are in this case). Spent the day working on this, and am happy to report I’ve just gotten it all working for 2.3.  
  > **username_6**: Does this work for you now or does it not, @username_2? Or are you already on 2.3?  
  
  ---
  
  ### Answer by username_1 on 2014-06-12. Score: 2
  
  Would this do it?
  
  ```
  {% set blocks = entry.matrixFieldHandle %}
  {% for block in blocks if block.yourDateField|date >= now|date %}
  
  {% endfor %}
  
  ```
  
  
  ---
  
  