<p>This happens because you set the parameter on the ElementCriteriaModel to get entries with that specific <a href="http://buildwithcraft.com/docs/templating/datetime" rel="nofollow">datetime</a>. If you omit a time when you compose a datetime with strings, you'll still get a time (00:00:00) and even a timezone set on it:</p>

<pre><code>{% set myDatetime = '2014-08-12' %}

{# Print the datetime in ISO 8601 format / 2014-08-12T00:00:00+02:00 #}
{{ myDatetime|date('c') }}
</code></pre>

<p>This is how you set the parameter to accept datetime ranges:</p>

<pre><code>{% set myDatetime = thisyear ~ '-' ~ thismonth ~ '-' ~ day %}
{% set entries = craft.entries.postDate('and', '&gt;= ' ~ myDatetime, '&lt; ' ~ myDatetime|date_modify('+1 day')) %}
</code></pre>

CC BY-SA 3.0
2016-04-07T03:49:13.563Z
How it is written in php?
Vitaliy  Badalov
CC BY-SA 3.0
2014-08-12T16:13:59.457Z
2014-08-12T16:19:44.307Z
2014-08-12T16:19:44.307Z
carlcs
<p>I'm trying to pull entries from a database where the postDate is a specific date.</p>

<pre><code>{% set today = thisyear ~ "-" ~ thismonth ~ "-" ~ day %}
{% set today = today|date('Y-m-d') %}

{% set entries = craft.entries(params).section('calendar').status('null').postDate(today|date('Y-m-d'))%}
</code></pre>

<p>This only gets the entry if the Time element of the Post Date is empty or 00:00
How can I correct this to pull the entries even if it has a time associated with the Post Date</p>

CC BY-SA 3.0
2014-08-15T07:05:55.810Z
mmc, did my answer work for you?
carlcs
CC BY-SA 3.0
2014-08-15T09:47:41.763Z
Yep it worked on my original solution. Thanks!!
mmc501
<entries><datetime><queries>
Get entries by date but ignore time
# Get entries by date but ignore time

(Asked by: username_0 on 2014-08-12)

I'm trying to pull entries from a database where the postDate is a specific date.
{% set today = thisyear ~ "-" ~ thismonth ~ "-" ~ day %}
{% set today = today|date('Y-m-d') %}

{% set entries = craft.entries(params).section('calendar').status('null').postDate(today|date('Y-m-d'))%}

This only gets the entry if the Time element of the Post Date is empty or 00:00
How can I correct this to pull the entries even if it has a time associated with the Post Date

**Tags:** entries, datetime, queries

> **Comments:**
> **username_1**: mmc, did my answer work for you?  
> **username_0**: Yep it worked on my original solution. Thanks!!  

---

## 1 answers

### Answer by username_1 on 2014-08-12. Score: 4 | Accepted answer

This happens because you set the parameter on the ElementCriteriaModel to get entries with that specific datetime. If you omit a time when you compose a datetime with strings, you'll still get a time (00:00:00) and even a timezone set on it:
{% set myDatetime = '2014-08-12' %}

{# Print the datetime in ISO 8601 format / 2014-08-12T00:00:00+02:00 #}
{{ myDatetime|date('c') }}

This is how you set the parameter to accept datetime ranges:
{% set myDatetime = thisyear ~ '-' ~ thismonth ~ '-' ~ day %}
{% set entries = craft.entries.postDate('and', '>= ' ~ myDatetime, '< ' ~ myDatetime|date_modify('+1 day')) %}

> **Comments:**
> **username_2**: How it is written in php?  

---

