title: postgresql query to get counts between 12:00 and 12:00
body: <p>I have the following query that works fine, but it is giving me counts for a single, whole day (00:00 to 23:59 UTC).  For example, it's giving me counts for all of January 1 2017 (00:00 to 23:59 UTC).</p>
  
  <p>My dataset lends itself to be queried from 12:00 UTC to 12:00 UTC.  For example, I'm looking for all counts from Jan 1 2017 12:00 UTC to Jan 2 2017 12:00 UTC.</p>
  
  <p>Here is my query: </p>
  
  <pre><code>SELECT count(DISTINCT ltg_data.lat), cwa, to_char(time, 'MM/DD/YYYY') 
  FROM counties 
  JOIN ltg_data on ST_contains(counties.the_geom, ltg_data.ltg_geom) 
  WHERE cwa = 'MFR' 
    AND time BETWEEN '1987-06-01' 
    AND '1992-08-1' 
  GROUP BY cwa, to_char(time, 'MM/DD/YYYY');
  </code></pre>
  
  <p>FYI...I'm changing the format of the time so I can use the results more readily in javascript.</p>
  
  <p>And a description of the dataset.  It's thousands of point data that occurs within various polygons every second.  I'm determining if the points are occurring withing the polygon "cwa = MFR" and then counting them.</p>
  
  <p>Thanks for any help!</p>