Answers.Body: <p>Immediately found a solution!</p>
  <pre><code>{% set newsQuery = craft.entries({
      section: 'news',
      after: now|date_modify('0:00 -1 months'),
  }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-29T12:26:49.303Z
Answers.LastActivityDate: 2021-01-29T12:26:49.303Z
Answers.UserDisplayName: supazu
Body: <p>I’m trying to show only entries for the created in the last month. I’ve taken this from the example in <a href="https://craftcms.com/docs/3.x/entries.html#postdate" rel="nofollow noreferrer">the docs</a> but it ends up showing nothing. There’s 100% entries with a postDate in the last month.</p>
  <p>What am I missing?</p>
  <pre><code>{% set start = now|date_modify(&quot;-1 month&quot;)|date('Y-m-d') %}
  {% set end = now|date('Y-m-d') %}
  
  {% set newsQuery = craft.entries({
      section: 'news',
      postDate: ['and', &quot;&gt;= #{start}&quot;, &quot;&lt; #{end}&quot;],
  }) %}
  </code></pre>
  <p>Thanks!</p>
  
Tags: <templating><query>
Title: Query entries posted in the past month
ThreadText: # Query entries posted in the past month
  
  (Asked by: username_0 on 2021-01-29)
  
  I’m trying to show only entries for the created in the last month. I’ve taken this from the example in [the docs](https://craftcms.com/docs/3.x/entries.html#postdate) but it ends up showing nothing. There’s 100% entries with a postDate in the last month.
  
  What am I missing?
  
  ```
  {% set start = now|date_modify("-1 month")|date('Y-m-d') %}
  {% set end = now|date('Y-m-d') %}
  
  {% set newsQuery = craft.entries({
      section: 'news',
      postDate: ['and', ">= #{start}", "< #{end}"],
  }) %}
  
  ```
  
  Thanks!
  
  **Tags:** templating, query
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-01-29. Score: 4 | Accepted answer
  
  Immediately found a solution!
  
  ```
  {% set newsQuery = craft.entries({
      section: 'news',
      after: now|date_modify('0:00 -1 months'),
  }) %}
  
  ```
  
  
  ---
  
  