Answers.Body: <p>100% untested, but something like this should work using Twig's <a href="http://twig.sensiolabs.org/doc/filters/date_modify.html" rel="nofollow">date_modify</a> filter.</p>
  
  <pre><code>{% set startDate = now|date_modify("-6 months") %}
  
  {% set allEntries = craft.entries.section('blog').limit(null).postDate('&gt;= ' ~ startDate) %}
  
  {% for date, entries in allEntries | group("postDate|date('F Y')") %}
      &lt;h2&gt;{{ date }}&lt;/h2&gt;
      &lt;ul&gt;
          {% for entry in entries %}
              &lt;li&gt;{{ entry.getLink() }}&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-04T10:14:23.053Z
Answers.Text: Instead of `.postDate()` could this also be performed on a custom date/time field (in this case called `startDate`). I'm having trouble getting it to work: `.startDate('>= ' ~ range)`
Answers.UserDisplayName: Ian Young
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-04T11:06:30.870Z
Answers.Text: Scratch that, I've managed to get it working now. Thanks Brad! :)
Answers.UserDisplayName: Ian Young
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-04T16:48:10.870Z
Answers.Text: No worries! @Ian
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-08-03T23:27:42.403Z
Answers.LastActivityDate: 2016-08-03T23:27:42.403Z
Answers.UserDisplayName: Brad Bell
Body: <p>From the Creating an Archive Page for Entries article in the Craft docs. How could I limit it so that it grouped by month but limited things to 6 months?:</p>
  
  <pre><code>{% set allEntries = craft.entries.section('blog').limit(null) %}
  {% for date, entries in allEntries | group("postDate|date('F Y')") %}
      &lt;h2&gt;{{ date }}&lt;/h2&gt;
      &lt;ul&gt;
          {% for entry in entries %}
              &lt;li&gt;{{ entry.getLink() }}&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endfor %}
  </code></pre>
  
Tags: <group><limit><archives>
Title: Date Archives: Last 6 months
ThreadText: # Date Archives: Last 6 months
  
  (Asked by: username_0 on 2016-08-03)
  
  From the Creating an Archive Page for Entries article in the Craft docs. How could I limit it so that it grouped by month but limited things to 6 months?:
  
  ```
  {% set allEntries = craft.entries.section('blog').limit(null) %}
  {% for date, entries in allEntries | group("postDate|date('F Y')") %}
      <h2>{{ date }}</h2>
      <ul>
          {% for entry in entries %}
              <li>{{ entry.getLink() }}</li>
          {% endfor %}
      </ul>
  {% endfor %}
  
  ```
  
  **Tags:** group, limit, archives
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-08-03. Score: 1 | Accepted answer
  
  100% untested, but something like this should work using Twig's [date\_modify](http://twig.sensiolabs.org/doc/filters/date_modify.html) filter.
  
  ```
  {% set startDate = now|date_modify("-6 months") %}
  
  {% set allEntries = craft.entries.section('blog').limit(null).postDate('>= ' ~ startDate) %}
  
  {% for date, entries in allEntries | group("postDate|date('F Y')") %}
      <h2>{{ date }}</h2>
      <ul>
          {% for entry in entries %}
              <li>{{ entry.getLink() }}</li>
          {% endfor %}
      </ul>
  {% endfor %}
  
  ```
  
  > **Comments:**
  > **username_0**: Instead of `.postDate()` could this also be performed on a custom date/time field (in this case called `startDate`). I'm having trouble getting it to work: `.startDate('>= ' ~ range)`  
  > **username_0**: Scratch that, I've managed to get it working now. Thanks username_1! :)  
  > **username_1**: No worries! @Ian  
  
  ---
  
  