Q&A for students, teachers, polyglots, and anyone interested in the techniques of second-language acquisition
-- At what hour do I ask most posts, both questions and answers? -- UTC (GMT) time zone. -- Parameters: -- UserId -- HourOrDOW (1 - hours, 2 - day of week) IF ##HourOrDOW:int?1## = 1 SELECT DATEPART("hour", CreationDate) AS [Hour you add a post], COUNT(*) AS [Number of your posts per hour] FROM Posts WHERE OwnerUserId = ##UserId## GROUP BY DATEPART("hour", CreationDate) ELSE SELECT --DATEPART("weekday", CreationDate) AS [Weekday you add a post], COUNT(*) AS [Number of your posts per weekday], DATENAME(dw, CreationDate) FROM Posts WHERE OwnerUserId = ##UserId## GROUP BY DATENAME(dw, CreationDate)