Best time to post


Please login or register to vote for this query.

(click on this box to dismiss)

Stack Overflow

Q&A for professional and enthusiast programmers

-- Get the dates/times that responses were given.
-- optionally filter on accepted response.
-- Argmax = 4.56 = Wed, 2pm (tz?)
       --datename(dw, creationdate) [Day],
       --datepart(hh, creationdate) [Hour],
  case datename(dw, creationdate)
    WHEN 'Sunday' THEN 1
    WHEN 'Monday' THEN 2
    WHEN 'Tuesday' THEN 3
    WHEN 'Wednesday' THEN 4
    WHEN 'Thursday' THEN 5
    WHEN 'Friday' THEN 6
    WHEN 'Saturday' THEN 7
  END + datepart(hh, creationdate)/25. dt
from posts
where 1=1
AND PostTypeId = 2
group by datename(dw, creationdate),
         datepart(hh, creationdate)
order by 1

Enter Parameters

Switch sites:
loading Hold tight while we fetch your results