<p>have you tried setting a time for the end date? because I think Craft always saves time with your date fields.</p>

<pre><code>{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') ~ ' 23:59:59' %}
</code></pre>

CC BY-SA 4.0
2019-02-26T19:21:29.890Z
2019-02-26T19:21:29.890Z
Matthias Redl-Mann
<p>I am grabbing a date range from a URL query string like so:</p>

<pre><code>https://website.com/qa/search-feedback-results?datestart=2019-01-01&amp;dateend=2019-02-26
</code></pre>

<p>I can't figure out how to include posts that were submitted on the end date that is in the range. In the above example, any posts dated <code>2019-02-26</code> are not showing up in my results.</p>

<p>Here's my code:</p>

<pre><code>{% set vDatestart = craft.app.request.getParam('datestart')|date('Y-m-d') %}
{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') %}
{% set vParams = vParams|merge({ postDate: ['and', '&gt;= ' ~ vDatestart, '&lt;= ' ~ vDateend] }) %}
</code></pre>

<datetime><postdate>
Date range to include end date
# Date range to include end date

(Asked by: username_0 on 2019-02-26)

I am grabbing a date range from a URL query string like so:
https://website.com/qa/search-feedback-results?datestart=2019-01-01&dateend=2019-02-26

I can't figure out how to include posts that were submitted on the end date that is in the range. In the above example, any posts dated 2019-02-26 are not showing up in my results.
Here's my code:
{% set vDatestart = craft.app.request.getParam('datestart')|date('Y-m-d') %}
{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') %}
{% set vParams = vParams|merge({ postDate: ['and', '>= ' ~ vDatestart, '<= ' ~ vDateend] }) %}

**Tags:** datetime, postdate


---

## 1 answers

### Answer by username_1 on 2019-02-26. Score: 2 | Accepted answer

have you tried setting a time for the end date? because I think Craft always saves time with your date fields.
{% set vDateend = craft.app.request.getParam('dateend')|date('Y-m-d') ~ ' 23:59:59' %}


---

