Date expressions
This section covers date expression evaluation rules.
A date expression evaluates to a DATE data type value.
MAIN
DEFINE r, c DATE
LET c = TODAY + 4
LET r = ( c - 2 )
END MAIN
The operands of a date expression can be one of:
- A character string literal that can be evaluated to a date based on the DBDATE environment variable.
- A variable or constant of type
DATE. - A function returning a single date value.
- A unary
+or-sign associated with an integer expression representing a number of days. - The
TODAYconstant. - A
CURRENTexpression withYEAR TO DAYqualifiers. - An
EXTENDexpression withYEAR TO DAYqualifiers.
If a date expression includes an operand whose value is not a date data type, the runtime system attempts to convert the value to a date value following the data conversion rules.
If an element of an date expression is NULL, the expression is evaluated to NULL.