title: extract year, mounth and day from a date using eclipselink jql
body: <p>I am sending a date from a primefaces calendar to backing bean. The object that primefaces send is Date. </p>
  
  <pre><code>&lt;p:calendar id="exact_Date" value="#{h.model.arhExactDate}" pattern="yyyy/MM/dd"/&gt;
  </code></pre>
  
  <p>The date in debugger looks like Thu Mar 02 00:00:00 EET 2017.</p>
  
  <p>I want to extract from this only the date part (withowt time) and compare it with a timestamp from the database <strong>like</strong> 2017-03-02 18:57:19.152 using eclipselink jpql.</p>
  
  <p>So it will be something like: cast(2017-03-02 18:57:19.152 as varchar) like 2017-03-02 18 where the part after "like" is the date prat from the date.</p>
  
  <p>Looking at this <a href="http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic_JPA_Development/Querying/JPQL" rel="nofollow noreferrer">basic eclipselink guide</a> I see that I can use extract method like: <strong>extract(year from my_date)</strong>. But how can I extract all I need?</p>
  
  <p>I tried the query below but is not a valid expression:</p>
  
  <pre><code>select e from MyEntity e where  extract(year from e.reqDate) = :extract(year from exactDate)
  </code></pre>
  
  <p>If it worked, I would have liked to have something like:</p>
  
  <pre><code> extract(year,mounth,day from e.reqDate) =:(exactDate)
  </code></pre>
  
  <p>I don't want something like: 
      extract(year from e.reqDate) = :extract(year from exactDate) and  extract(month from e.reqDate) = :extract(month from exactDate) and  extract(day from e.reqDate) = :extract(day from exactDate)</p>