Answers.Body: <p>Looks like I finally found an answer to it</p>
  
  <p>year being my param</p>
  
  <p>date being my custom date field</p>
  
  <pre><code>{% set dateParam = 'and, &gt;= ' ~ year ~ '-01-01, &lt; ' ~ (year + 1) ~ '-01-01' %}
  &lt;ul&gt;
      {% for entry in craft.entries.section('evenements').order('date desc').date(dateParam) %}
          &lt;li&gt;&lt;a href="{{ entry.url }}"&gt;{{ entry.title }}&lt;/a&gt;&lt;/li&gt;
      {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-09T22:33:21.647Z
Answers.Text: Curiously, does that work? I would think you'd need to pass an array into that param, like this:
  
  
  `{% set dateParam = ['and', '>= ' ~ year, '< ' ~ (year + 1)] %}`
Answers.UserDisplayName: Michael Rog
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-10T14:52:26.950Z
Answers.Text: Well, it does work like I wrote it.  But, it works the way you did it too.  I get the exact same results both ways. Interesting...  Keeping your way in my code though, it is definitely cleaner.
Answers.UserDisplayName: Eric Chantigny
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-10T15:06:03.503Z
Answers.Text: Cool. Where did you find the example/inspiration for feeding a string into the date param?
Answers.UserDisplayName: Michael Rog
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-10T23:25:42.683Z
Answers.Text: p.s. I double-checked with Brad. He confirmed that date parameters accept a string or an array by design: _DateFieldType_'s `modifyElementsQuery` calls `DbHelper::parseDateParam()` and the first thing that does is convert the value to an array if it's not one: https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/DbHelper.php#L557 — Pretty cool!
Answers.UserDisplayName: Michael Rog
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-12T00:30:59.367Z
Answers.Text: I found it on another question here somewhere.  I can't remember how I found it though. I repurposed the answer to my situation and it worked.
Answers.UserDisplayName: Eric Chantigny
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-03-09T21:50:22.337Z
Answers.LastActivityDate: 2016-03-09T21:50:22.337Z
Answers.UserDisplayName: Eric Chantigny
Body: <p>I have a date field (date) in my entry and I wish to get all entries of a specified year.  Can’t figure it out at all.  Here’s what I have now, to sort them by that field: </p>
  
  <pre><code>craft.entries.section('evenements').order('date desc')
  </code></pre>
  
  <p>My "year" is passed to the page through routing and is named "year".  I can get that. </p>
  
  <p>Thanks</p>
  
Tags: <entries><datetime><routing>
Title: Displaying entires by year from a custom date field
ThreadText: # Displaying entires by year from a custom date field
  
  (Asked by: username_0 on 2016-03-09)
  
  I have a date field (date) in my entry and I wish to get all entries of a specified year. Can’t figure it out at all. Here’s what I have now, to sort them by that field:
  
  ```
  craft.entries.section('evenements').order('date desc')
  
  ```
  
  My "year" is passed to the page through routing and is named "year". I can get that.
  
  Thanks
  
  **Tags:** entries, datetime, routing
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-03-09. Score: 3 | Accepted answer
  
  Looks like I finally found an answer to it
  
  year being my param
  
  date being my custom date field
  
  ```
  {% set dateParam = 'and, >= ' ~ year ~ '-01-01, < ' ~ (year + 1) ~ '-01-01' %}
  <ul>
      {% for entry in craft.entries.section('evenements').order('date desc').date(dateParam) %}
          <li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
      {% endfor %}
  </ul>
  
  ```
  
  > **Comments:**
  > **username_1**: Curiously, does that work? I would think you'd need to pass an array into that param, like this:   `{% set dateParam = ['and', '>= ' ~ year, '< ' ~ (year + 1)] %}`  
  > **username_0**: Well, it does work like I wrote it.  But, it works the way you did it too.  I get the exact same results both ways. Interesting...  Keeping your way in my code though, it is definitely cleaner.  
  > **username_1**: Cool. Where did you find the example/inspiration for feeding a string into the date param?  
  > **username_1**: p.s. I double-checked with Brad. He confirmed that date parameters accept a string or an array by design: _DateFieldType_'s `modifyElementsQuery` calls `DbHelper::parseDateParam()` and the first thing that does is convert the value to an array if it's not one: https://github.com/pixelandtonic/Craft-Release/blob/master/app/helpers/DbHelper.php#L557 — Pretty cool!  
  > **username_0**: I found it on another question here somewhere.  I can't remember how I found it though. I repurposed the answer to my situation and it worked.  
  
  ---
  
  