Q&A about the site for users of TeX, LaTeX, ConTeXt, and related typesetting systems
-- At what hour do I add most posts, both questions and answers? -- UTC (GMT) time zone. The week starts with Sunday. -- Parameters: -- UserId -- HourOrDOW (1 - hours, 2 - day of week, 3 - both) DECLARE @Choice int = ##HourOrDOW:int?1## DECLARE @Mine int = ##Mine:int?1## DECLARE @Where nvarchar(100) = '' DECLARE @UsedId nvarchar(20) = ##UserId:string## IF @Mine = 1 SET @Where = @Where + N'WHERE OwnerUserId = ' + ##UserId:string## PRINT @Where PRINT @Mine PRINT 'OwnerUserId = '+@UsedId IF @Choice = 1 SELECT DATEPART("hour", CreationDate) AS [Hour you add a post], COUNT(*) AS [Number of your posts per hour, UTC (GMT)] FROM Posts --- WHERE IF (@Mine = 1) 'OwnerUserId = '+@UsedId ELSE TRUE GROUP BY DATEPART("hour", CreationDate) /* ELSE IF @Choice = 2 WITH tmp AS ( SELECT *, DATEPART("weekday", CreationDate) AS wpart DATENAME(dw, CreationDate) AS wname FROM Posts ) SELECT wpart AS [Weekday you add a post], -- Little hack to show DoW with data.SO graph builder wname, COUNT(*) AS [Number of your posts per weekday] FROM tmp WHERE OwnerUserId = ##UserId## GROUP BY wpart, wname ORDER BY wpart ELSE IF @Choice = 3 WITH tmp AS ( SELECT *, ROUND((CAST(DATEPART("weekday", CreationDate) AS float) + CAST(DATEPART("hour", CreationDate) AS float) / 24), 2) AS cd FROM Posts ) SELECT cd AS [Day of week + time], COUNT(*) AS [Number of posts] FROM tmp WHERE OwnerUserId = ##UserId## GROUP BY cd ORDER BY cd */