DB2 Scalar functions - DATE
The DATE function returns a date from a value.
The schema is SYSIBM.
The special behavior of DATE with the Db2® compatibility features for Oracle applications is described in DATE data type based on TIMESTAMP(0).
A value with a numeric data type must be a positive number with an integral value less than or equal to 3 652 059.
A character string must be a valid string representation of a date or timestamp or a string of length 7. If the value is a string of length 7, it must represent a valid date in the form yyyynnn , where yyyy are digits denoting a year, and nnn are digits between 001 and 366, denoting a day of that year.
In a Unicode database, if an expression returns a value of a graphic string data type, the value is first converted to a character string before the function is executed.
The result of the function is a DATE. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
The other rules depend on the data type of the argument:
Assume that the column RECEIVED (whose data type is TIMESTAMP) has an internal value equivalent to '1988-12-25-17.12.30.000000'.
DATE(RECEIVED)
DATE('1988-12-25')
DATE('25.12.1988')
DATE(35)