ZenQL search – relative time period
Log in to add to favouritesA relative time period is a token that can convert a date and time value, relative to the current date and time (UTC). It can be used in an operator or as a parameter of a date time function.
Syntax
The token consists of 1 or more space-delimited segments and can optionally contain a preceding plus or minus sign. The sign can only be used once and is applied to the whole expression. When combining segments, there is no need enclose them in double quotes.
<token>:=
[- | +]<segment>[ <segment> ...n]
<segment>:=
<int>y|M|w|d|h|m
Period | Syntax | Example |
Year | {int}y | 1y |
Month | {int}M | 2M |
Week | {int}w | 2w |
Day | {int}d | 5d |
Hour | {int}h | 10h |
Minute | {int}m | 15m |
Examples
- Show all items that have been created in the last 24 hours.
sys.version.created >= -1d
- Used stand-alone to list records created in the last month plus 1 week.
sys.version.created >= -1M 1w
- Used as a parameter to an Expression Function to list records created last year. The year is inferred by the date function.
sys.version.created >= startOfYear(-1) and <= endOfYear(-1)