title: SQL Query - Average time from datetime field
body: <p>I'm struggling with what I thought would be a simple SQL query. Running SQL Server 2014</p>
  
  <p>I have an SQL table, "Visits":</p>
  
  <pre><code>Id | EntryTime | Duration
  </code></pre>
  
  <p>And I want to find the average entry TIME OF DAY between two dates, taking into account all records between those dates.</p>
  
  <p>so if my <code>EntryTime</code> field between my dates is:</p>
  
  <pre><code>2016-04-28 12:00:00
  2016-04-20 10:00:00
  2016-04-19 08:00:00
  2016-04-17 10:00:00
  </code></pre>
  
  <p>Then the average time returned should just be:</p>
  
  <pre><code>10:00:00
  </code></pre>
  
  <p>The date should not be taken into account at all, and it should be returned in string format, or a manner which returns ONLY <code>10:00:00</code>.</p>