Datetime expressions
This section covers date-time expression evaluation rules.
A datetime expression evaluates to a DATETIME
data type.
MAIN
DEFINE r, c DATETIME YEAR TO SECOND
LET c = CURRENT YEAR TO SECOND
LET r = c + INTERVAL( 234-02 ) YEAR TO MONTH
END MAIN
The operands of a datetime expression can be one of:
- A datetime literal.
- A character string literal representing a
datetime with the format
YYYY-MM-DD hh:mm:ss.fffff
. - A variable or constant of
DATETIME
type. - A function returning a single datetime value.
- A unary
+
or-
sign associated with an interval expression. - A
CURRENT
expression. - An
EXTEND
expression.
If a datetime expression includes an operand whose value is not a datetime data type, the runtime system attempts to convert the value to a datetime value following the data conversion rules.
If an element of an integer expression is NULL
, the expression is evaluated to NULL
.