Time expressions return values of a time data type (DATE, DATETIME, or INTERVAL).
DATE expressions that return DATE values have this syntax:
Numeric date |
a date represented by digits and (optional) separator signs |
Function |
a function which returns exactly one value |
Named value |
a variable, a member of a record or an element of an array of the DATE data type or a compatible data type |
a character expression containing the format string |
DATETIME expressions that return DATETIME values have this syntax:
Numeric date and time |
a date and time value represented by digits and separator signs |
Function |
a function which returns exactly one value |
a numeric representation of a DATETIME value with separators followed by the DATETIME qualifier |
|
Named value |
a variable, a member of a record or an element of an array of the DATETIME data type or a compatible data type |
Expression |
|
DATETIME qualifier |
a range of the time units from the largest to the smallest |
INTERVAL expressions that return INTERVAL values have this syntax:
Numeric interval |
an INTERVAL value represented by digits and separator signs |
Function |
a function which returns exactly one value |
a numeric representation of an INTERVAL value with separators followed by the INTERVAL qualifier |
|
Named value |
a variable, a member of a record or an element of an array of the INTERVAL data type or a compatible data type |
an expression returning a positive or negative integer |
|
Time unit |
a keyword specifying the time unit: YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, or FRACTION |
DATE and DATETIME expressions are close but they are treated differently in arithmetic operations, FORMAT and PICTURE attributes influence them in a different way, and their values are stored in different data types.
All three data types belong to time data types. However, conversion between them is very limited.
DATE and DATETIME values can be interchangeable in the context where a time expression is required.
The values of INTERVAL data type cannot be converted to DATE or DATETIME data type.