<p>You are passing a string <code>&lt;= startDate</code> to the field parameter, but you actually want it to be a string <code>&lt;= 2016-01-01</code>, which you can get by concatenationg the <code>&lt;=</code> string with the datetime variable. So change your parameters like so:</p>

<p><code>postDate('&lt;= ' ~ startDate)</code> instead of<br>
<code>postDate('&lt;= startDate')</code></p>

CC BY-SA 3.0
2016-01-28T11:31:21.620Z
2016-01-28T11:38:10.143Z
2016-01-28T11:38:10.143Z
carlcs
<p>I've tried to follow a ton of other articles posted on Stackoverflow for showing posts between 2 dates. I just can't seem to get it working and I keep getting an error of: Call to a member function getTimestamp() on boolean</p>

<pre><code>{% set startDate = now | date_modify('first day of ' ~ qFilter) %}
{% set endDate = startDate | date_modify('+ 1 month') %}
{% set entries = craft.entries.section('events').postDate('&lt;= startDate').expiryDate('&gt;= endDate') %}
</code></pre>

<p>(qFilter is a url param: eg "May")</p>

<p>I'm trying to show posts that were live during a certain month.</p>

<entries><postdate>
Showing posts live during a date range
# Showing posts live during a date range

(Asked by: username_0 on 2016-01-28)

I've tried to follow a ton of other articles posted on Stackoverflow for showing posts between 2 dates. I just can't seem to get it working and I keep getting an error of: Call to a member function getTimestamp() on boolean
{% set startDate = now | date_modify('first day of ' ~ qFilter) %}
{% set endDate = startDate | date_modify('+ 1 month') %}
{% set entries = craft.entries.section('events').postDate('<= startDate').expiryDate('>= endDate') %}

(qFilter is a url param: eg "May")
I'm trying to show posts that were live during a certain month.

**Tags:** entries, postdate

---

## 1 answers

### Answer by username_1 on 2016-01-28. Score: 3 | Accepted answer

You are passing a string `<= startDate` to the field parameter, but you actually want it to be a string `<= 2016-01-01`, which you can get by concatenationg the `<=` string with the datetime variable. So change your parameters like so:

`postDate('<= ' ~ startDate)` instead of  
`postDate('<= startDate')`


---

