<p>You shouldn't need to use string concatenation here:</p>

<pre><code>.eventStartDate('&gt;= ' ~ 2014 ~ '-' ~ 09)
</code></pre>

<p>If you're hard coding the year and month, just use:</p>

<pre><code>.eventStartDate('&gt;= 2014-09-01')
</code></pre>

CC BY-SA 3.0
2014-08-12T17:25:55.987Z
2014-08-12T17:25:55.987Z
Brad Bell
<p>Ahhhhh. I was because before I changed that I was pulling from a segment which was a string. I figured it out though. Ended up with this which works out... </p>

<pre><code>{% set year = craft.request.segment(2) %}
{% set month = craft.request.segment(3) %}
{% set firstDayOfMonth = year ~ "-" ~ month ~ "-01" %}
{% set daysInThisMonth = firstDayOfMonth|date('t') %}
{% set lastDayOfMonth = year ~ "-" ~ month ~ "-" ~ daysInThisMonth %}

{% paginate craft.entries()
    .limit(7)
    .section('events')
    .eventStartDate('&gt;= ' ~ firstDayOfMonth | date("U"))
    .eventEndDate('&lt;= ' ~ lastDayOfMonth | date("U"))
as entriesOnPage %}
</code></pre>

CC BY-SA 3.0
2014-08-12T17:32:43.813Z
2014-08-12T17:32:43.813Z
Matt Green
<p>Why does this work fine</p>

<pre><code>{% paginate craft.entries().limit(7).section('events').eventStartDate('&gt;= ' ~ 2014 ~ '-' ~ 09) as entriesOnPage %}
</code></pre>

<p>But this does not</p>

<pre><code>{% paginate craft.entries().limit(7).section('events').eventStartDate('&gt;= ' ~ 2014 ~ '-' ~ 09) as entriesOnPage %}
</code></pre>

<p>I get this <a href="http://d.pr/i/NRvg" rel="nofollow">http://d.pr/i/NRvg</a></p>

<p>I also get errors when simply using '&lt;' so it seems to require only either a less than or equal to or a greater than or equal to operator.</p>

<p>Can someone point to some kind of documentation for what is allowed within the custom field filter -------------> this part ('&lt;= ' ~ 2014 ~ '-' ~ 09)</p>

CC BY-SA 3.0
2014-08-12T17:24:23.450Z
It's entirely possible I'm going blind, but what's the difference between those two queries?  They look identical to me.
Brad Bell
<datetime>
Custom field filtering
# Custom field filtering

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

Why does this work fine
{% paginate craft.entries().limit(7).section('events').eventStartDate('>= ' ~ 2014 ~ '-' ~ 09) as entriesOnPage %}

But this does not
{% paginate craft.entries().limit(7).section('events').eventStartDate('>= ' ~ 2014 ~ '-' ~ 09) as entriesOnPage %}

I get this http://d.pr/i/NRvg
I also get errors when simply using '<' so it seems to require only either a less than or equal to or a greater than or equal to operator.
Can someone point to some kind of documentation for what is allowed within the custom field filter -------------> this part ('<= ' ~ 2014 ~ '-' ~ 09)

**Tags:** datetime
> **Comments:**
> **username_1**: It's entirely possible I'm going blind, but what's the difference between those two queries?  They look identical to me.  

---

## 2 answers

### Answer by username_1 on 2014-08-12. Score: 1

You shouldn't need to use string concatenation here:
.eventStartDate('>= ' ~ 2014 ~ '-' ~ 09)

If you're hard coding the year and month, just use:
.eventStartDate('>= 2014-09-01')


---

### Answer by username_0 on 2014-08-12. Score: 1

Ahhhhh. I was because before I changed that I was pulling from a segment which was a string. I figured it out though. Ended up with this which works out... 
{% set year = craft.request.segment(2) %}
{% set month = craft.request.segment(3) %}
{% set firstDayOfMonth = year ~ "-" ~ month ~ "-01" %}
{% set daysInThisMonth = firstDayOfMonth|date('t') %}
{% set lastDayOfMonth = year ~ "-" ~ month ~ "-" ~ daysInThisMonth %}

{% paginate craft.entries()
    .limit(7)
    .section('events')
    .eventStartDate('>= ' ~ firstDayOfMonth | date("U"))
    .eventEndDate('<= ' ~ lastDayOfMonth | date("U"))
as entriesOnPage %}


---

