title: HQl query to get week of the year
body: <p>I need to make the following MSSQLServer query which gets number of changes made in current weeek </p>
  
  <pre><code>select count(1) from Audit_tbl where DATEPART( wk, action_time)=DATEPART( wk,getdate())
  </code></pre>
  
  <p>I get strucked with the functionDATEPART( wk, action_time)=DATEPART( wk,getdate()) is there any equivalent in HQL. </p>
  
  <p>Also is there a way to get date(2014-03-24) part from 2014-03-24 20:56:26.297 in HQL</p>
  
  <p><strong>Update:</strong></p>
  
  <pre><code>select DATEADD(day,datediff(day,0,action_time),0) AS ActionDate,
  count(1) as total 
  from Server_tbl
  where YEAR(action_time) = YEAR(getdate())
  group by DATEADD(day,datediff(day,0,action_time),0)
  </code></pre>
  
  <p>it gives the records group by actiontime(stored in db as timestamp)</p>