Relative time period
Log in to add to favouritesA 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
Used stand-alone to list records created in the last 24 hours.
{
"pageIndex": 0,
"pageSize": 25,
"where": [
{
"field": "sys.version.created",
"greaterThanOrEqualTo": "-1d"
}
]
}
Used stand-alone to list records created since the start of the last week of the previous month.
{
"pageIndex": 0,
"pageSize": 25,
"where": [
{
"field": "sys.version.created",
"greaterThanOrEqualTo": "-1M 1w"
}
]
}
Used as a parameter to an Expression Function to list records created last year.
{
"pageIndex": 0,
"pageSize": 25,
"where": [
{
"field": "sys.version.created",
"greaterThanOrEqualTo": "startOfYear(-1)"
},
{
"field": "sys.version.created",
"lessThanOrEqualTo": "endOfYear(-1)"
}
]
}