title: Ecto/Elixir, How can I query by date?
body: <p>I am working on statistics page of my app and trying to query data by date. </p>
  
  <p>To get the date range, I use <code>Calendar.Date</code></p>
  
  <pre><code>date_range = Date.days_after_until(start_date, end_date, true)
  |&gt; Enum.to_list
  </code></pre>
  
  <p>And it returns date list of dates and each date looks like <code>"2017-04-07"</code>. So with the date I got from <code>date_range</code>, I tried to query but it triggers an error like below.</p>
  
  <p><code>where cannot be cast to type Ecto.DateTime in query: from o in Myapp.Order,
   where: o.created_date &gt;= ^~D[2017-04-07]</code></p>
  
  <p>For <code>created_date</code> field of Order, I made field like this,
  <code>field :created_date, Ecto.DateTime</code>.</p>
  
  <p>If I want to query by date, how can I query it? </p>
  
  <p>Thank in advance.</p>