Filtering by Day of Week or Hour of Day
You can add an expression to the predicate of a tsquery statement that limits the stream to specified days of the week or to a range of hours in each day.
By Day – Limits the stream to selected days of the week.
day in ()expression takes an argument with a comma-separated list of days of the week, enclosed in parentheses. The days of the week are numbered 1 through 7; 1 = Monday, 2 = Tuesday, and so on. Use the following syntax:
day in (#, #, ...)
day in (1,2,3,4,5)
By Hour – Limits the stream to a range of hours each day.
hour inexpression takes an argument with a range of hours separated by a colon and enclosed in square brackets. Valid values are integers 0–23:
hour in [#:#]
hour in [9:17]
Add the day or time range expression after the
WHERE clause. Do not use the
AND keyword. For example:
select fd_open where category = ROLE and roleType = SERVICEMONITOR day in (1,2,3,4,5)
hour inexpressions. Always put the
dayexpression before the
hourexpression. The following example limits the stream to weekdays between 9:00 a.m. and 5:00 p.m.:
select fd_open where category = ROLE and roleType = SERVICEMONITOR day in (1,2,3,4,5) hour in [9:17]