Answers.Body: <p>You won't be able to paginate messageList, because that's just an array... According to the <a href="http://buildwithcraft.com/docs/templating/paginate#parameters" rel="nofollow noreferrer">official documentation on the <code>{% paginate %}</code> tag</a>, only an <strong>ElementCriteriaModel</strong> can be paginated.</p>
  
  <p>To see how to create an ElementCriteriaModel which has already been filtered by month, check out <a href="https://craftcms.stackexchange.com/a/447/45">Solution #2 in this thread...</a></p>
  
  <p>You'll end up with code that looks something like this:</p>
  
  <pre><code>{% set firstDayOfMonth = year ~ "-" ~ month ~ "-01" %}
  {% set daysInThisMonth = firstDayOfMonth|date('t') %}
  {% set lastDayOfMonth  = year ~ "-" ~ month ~ "-" ~ daysInThisMonth %}
  
  {% set thisMonthsEntries = craft.entries.section('messages').messageDate('and', '&gt;= ' ~ firstDayOfMonth, '&lt;= ' ~ lastDayOfMonth) %}
  
  {% paginate thisMonthsEntries as entriesOnPage %}
      {% for entry in entriesOnPage %}
          {# ... whatever your code does... #}
      {% endfor %}
  {% endpaginate %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-09T03:18:17.910Z
Answers.Text: You're very welcome! :)
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-11T16:19:05.760Z
Answers.Text: Is it possible to only compare to the month itself so that it finds all entries in that month regardless of year?
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-11T16:31:19.980Z
Answers.Text: The code to pull that off would be very different from what we've got here... This example creates a date **range** (from the 1st - 31st of a given month). What you just described would actually look for multiple ranges across X years. Since the pagination portion of this question has already been answered, I'd suggest posing that as a fresh question.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-09T03:16:10.040Z
Answers.LastActivityDate: 2014-08-09T03:16:10.040Z
Answers.LastEditDate: 2017-04-13T12:51:00.200Z
Answers.UserDisplayName: Lindsey D
Body: <p>Here is how I am filtering entries by a specific month: </p>
  
  <pre><code>{% set filterId = "July" %}
  {% set allEntries = craft.entries.section('messages') %}
  {% set filteredEntries = [] %}
  
  {% for msg in allEntries %}
  
    {% if msg.messageDate | date('F') == filterId | date('F') %}
      {% set filteredEntries = filteredEntries | merge([msg]) %}
    {% endif %}
  
  {% endfor %}
  
  {% set messageList = filteredEntries %}
  </code></pre>
  
  <p>How can I paginate messageList? Do I need to filter by month a different way for pagination to work?</p>
  
Tags: <entries><templating><filter>
Title: How do I filter entries by month using custom Date/Time field and paginate them?
ThreadText: # How do I filter entries by month using custom Date/Time field and paginate them?
  
  (Asked by: username_0 on 2014-08-08)
  
  Here is how I am filtering entries by a specific month:
  
  ```
  {% set filterId = "July" %}
  {% set allEntries = craft.entries.section('messages') %}
  {% set filteredEntries = [] %}
  
  {% for msg in allEntries %}
  
    {% if msg.messageDate | date('F') == filterId | date('F') %}
      {% set filteredEntries = filteredEntries | merge([msg]) %}
    {% endif %}
  
  {% endfor %}
  
  {% set messageList = filteredEntries %}
  
  ```
  
  How can I paginate messageList? Do I need to filter by month a different way for pagination to work?
  
  **Tags:** entries, templating, filter
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-09. Score: 3 | Accepted answer
  
  You won't be able to paginate messageList, because that's just an array... According to the [official documentation on the `{% paginate %}` tag](http://buildwithcraft.com/docs/templating/paginate#parameters), only an **ElementCriteriaModel** can be paginated.
  
  To see how to create an ElementCriteriaModel which has already been filtered by month, check out [Solution #2 in this thread...](https://craftcms.stackexchange.com/a/447/45)
  
  You'll end up with code that looks something like this:
  
  ```
  {% set firstDayOfMonth = year ~ "-" ~ month ~ "-01" %}
  {% set daysInThisMonth = firstDayOfMonth|date('t') %}
  {% set lastDayOfMonth  = year ~ "-" ~ month ~ "-" ~ daysInThisMonth %}
  
  {% set thisMonthsEntries = craft.entries.section('messages').messageDate('and', '>= ' ~ firstDayOfMonth, '<= ' ~ lastDayOfMonth) %}
  
  {% paginate thisMonthsEntries as entriesOnPage %}
      {% for entry in entriesOnPage %}
          {# ... whatever your code does... #}
      {% endfor %}
  {% endpaginate %}
  
  ```
  
  > **Comments:**
  > **username_1**: You're very welcome! :)  
  > **username_0**: Is it possible to only compare to the month itself so that it finds all entries in that month regardless of year?  
  > **username_1**: The code to pull that off would be very different from what we've got here... This example creates a date **range** (from the 1st - 31st of a given month). What you just described would actually look for multiple ranges across X years. Since the pagination portion of this question has already been answered, I'd suggest posing that as a fresh question.  
  
  ---
  
  