Relative time period
Created by zengenti, last updated 24 Sep 2021
A Relative Time Period is a token that the Delivery API can convert to a date-time value relative to the current UTC date-time. It can be used stand-alone as an operand in search queries or passed as a parameter to any of the date-time Expression Functions. Used outside of an Expression Function now() is implied. That is, "-1d" is equivalent to "now(-1d)".
Syntax
The token consists of 1 or more space-delimited segments and can optionally contain a preceding plus or minus sign. Thus the syntax is:
<token>:=
[- | +]<segment>[ <segement> ...n]
<segment>:=
<int>y|M|w|d|h|m
JSON
{
"pageIndex": 0,
"pageSize": 25,
"where": [
{
"field": "sys.version.created",
"greaterThanOrEqualTo": "-1d"
}
]
}
JSON
{
"pageIndex": 0,
"pageSize": 25,
"where": [
{
"field": "sys.version.created",
"greaterThanOrEqualTo": "-1M 1w"
}
]
}
JSON
{
"pageIndex": 0,
"pageSize": 25,
"where": [
{
"field": "sys.version.created",
"greaterThanOrEqualTo": "startOfYear(-1)"
},
{
"field": "sys.version.created",
"lessThanOrEqualTo": "endOfYear(-1)"
}
]
}