How to display entries relevent to date assigned I am creating a website for not-for-profit organization that help victum of domestic violence. I have a page called Event which display all fund raising events under each month. 

I have setup Date/Time field and 12 months tabs and want to know how to display the entries for each month. For example I assign two entries for Feb and when I click on Feb tab, the entries will display.

Here is the sample code I wrote and copied Marion Newlevant's suggestion but when I tested it does not work. Any ideas?

Here is what my html structure to display the entries for each month. 

&lt;div class="recent-events2"&gt;
  &lt;ul class="month-tabs"&gt;
    &lt;li{% set startDate = year~'-'~month~'-01' %}&lt;/li&gt;
  &lt;/ul&gt;

  &lt;div class="events"&gt;

    {% set monthEvents = craft.entries
      .section('events')
      .dateField(['and', '&gt;= '~startDate, '&lt; '~endDate])
    %}
    &lt;div class="item"&gt;
      &lt;div&gt;

        {% for asset in entry.eventThumbnail %}
          {% if asset in entry.eventThumbnail %}
            &lt;img src="{{ asset.getUrl('eventThumbnail') }}" alt="{{ asset.title }}"&gt;
          {% else %}
            &lt;img src="{{ siteUrl }}public/assets/img/grey_image_placeholder.jpg" alt="Skyfoundation"&gt;
          {% endif %}              
        {% endfor %} 

        &lt;h2&gt;{{ entry.title }}&lt;/h2&gt;
        &lt;span&gt;{{ entry.subtitle }}&lt;/span&gt;
        &lt;p&gt;{{ entry.eventBlurp}}&lt;/p&gt;

        {% for block in entry.eventOrganiser %}
          {% if block.type == "eventDate" %}
            &lt;div class="ticket-cart"&gt; 
              &lt;a href="{{ block.ticketLink }}" class="ticket-btn"&gt;Buy Ticket&lt;/a&gt;
              &lt;div&gt;{{ block.ticketLeftover }} / &lt;i&gt;{{ block.ticketAvail }}&lt;/i&gt; tickets left&lt;/div&gt;
            &lt;/div&gt;
          {% endif %}
        {% endfor %}

      &lt;/div&gt;
    &lt;/div&gt;
  {% endfor %}

  &lt;/div&gt;

&lt;/div&gt;
Assuming your date/time field is called dateField, and your entries channel is events.

You want to fetch just the entries that have dates in that month. You can do that like this:

If you know the year and the month, the start of the month is (~ is the twig string concatination operator):

{% set startDate = year~'-'~month~'-01' %}


And the start of the next month is:

{% set endDate = startDate|date_modify('+1 month')|date('Y-m-d') %}


We use twig's date_modify filter to get the start of the next month, and then twig's date filter to convert that to a string.

Now you can fetch the entries for the month. You want ones where the dateField is on or after startDate and before endDate.

{% set monthEvents = craft.entries
  .section('events')
  .dateField(['and', '&gt;= '~startDate, '&lt; '~endDate])
%}