Relative time period
Log in to add to favouritesPage last updated 24 September 2024
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
{
    "pageIndex": 0,
    "pageSize": 25,
    "where": [
        {
            "field": "sys.version.created",
            "greaterThanOrEqualTo": "-1d"
        }
    ]
}{
    "pageIndex": 0,
    "pageSize": 25,
    "where": [
        {
            "field": "sys.version.created",
            "greaterThanOrEqualTo": "-1M 1w"
        }
    ]
}{
    "pageIndex": 0,
    "pageSize": 25,
    "where": [
        {
            "field": "sys.version.created",
            "greaterThanOrEqualTo": "startOfYear(-1)"
        },
        {
             "field": "sys.version.created",
            "lessThanOrEqualTo": "endOfYear(-1)"
        }
    ]
}