The TIME function returns a time from a value.
The schema is SYSIBM.
- expression
- An expression that returns a value of one of the following built-in data types:
DATE, TIME, TIMESTAMP, or a valid character string representation of a date, time, or timestamp that is not a CLOB.
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 TIME.
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:
- If the argument is a DATE or string representation of a date:
- If the argument is a TIME:
- If the argument is a TIMESTAMP:
- The result is the time part of the timestamp.
- If the argument is a string representation of time or timestamp:
- The result is the time represented by the string.
Example
Select all notes from the IN_TRAY sample table that were received at least one hour later in the day (any day) than the current time.
SELECT *
FROM IN_TRAY
WHERE TIME(RECEIVED) >= CURRENT TIME + 1 HOUR
© Copyright IBM Corp.