# 2.2.13.3.1.4 Literal Predicate

The literal predicate MUST be true if a given property stands in a given relation to a given literal. The basic syntax is as follows:

``` …property operator literal…
```

The operator MUST be one of the following:

Operator

Description

=

equal to

!= or <>

not equal to

>

greater than

>=

greater or equal to

<

less than

<=

less than or equal to

The literal is simply a value. The type of the value MUST match the type of the property. As a special case, properties that store dates can be compared to a time calculated from the current time. The function that does this is the DATEADD function.

The basic syntax for the DATEADD function is as follows:

``` DATEADD(unit, offset, time)
```

The time in the DATEADD function MUST be another DATEADD function or the GETGMTDATE function, which returns the current date and time. It MUST NOT be a date literal.   The offset MUST be a negative integer that specifies how much time to add to the specified time. Because this integer MUST be negative, the DATEADD function actually performs a subtraction.  Finally, the first parameter specifies the unit in which the second parameter is measured. Possible values are as follows:

• YEAR

• QUARTER

• MONTH

• WEEK

• DAY

• HOUR

• MINUTE

• SECOND

For example, the following predicate example:

``` …createdDate > DATEADD(YEAR, -1, GETGMTDATE())…
```

matches all items for which the createdDate property lies less than a year in the past.

``` literal-predicate        =   identifier *ws operator *ws value
value                    =   literal / dateadd-function
literal                  =   boolean / hex / decimal / float / string / date
dateadd-function         =   "DATEADD" *ws "(" *ws dateadd-unit *ws "," *ws dateadd-offset *ws "," *ws dateadd-datetime *ws ")"
dateadd-unit             =   "YEAR" / "QUARTER" / "MONTH" / "WEEK" / "DAY" / "HOUR" / "MINUTE" / "SECOND"
dateadd-offset           =   negative-decimal / negative-hex
dateadd-datetime         =   dateadd-function / "GETGMTDATE()"
```