When called with a numeric argument, FLOOR returns the largest integer equal to or smaller than the input argument.
When called with a date, time, or timestamp expression, FLOOR returns the largest value equal to or smaller than the input, subject to the precision specified by .
<FLOOR ( < - number-expression> )
FLOOR ( < - datetime-expression> TO < - time-unit> )
Returns null if any input argument is null.
Function | Result |
---|---|
FLOOR(2.0) | 2 |
FLOOR(-1.0) | -1 |
FLOOR(5.4) | 5 |
FLOOR(-3.3) | -4 |
FLOOR(-3* 3.1) | -10 |
FLOOR(TIMESTAMP ‘2004-09-30 13:48:23’ TO HOUR) | TIMESTAMP ‘2004-09-30 13:00:00’ |
FLOOR(TIMESTAMP ‘2004-09-30 13:48:23’ TO DAY) | TIMESTAMP ‘2004-09-30 00:00:00.0’ |
FLOOR(TIMESTAMP ‘2004-09-30 13:48:23’ TO YEAR) | TIMESTAMP ‘2004-01-01 00:00:00.0’ |
FLOOR ( TO ) is a SQLstream extension to the SQL standard.
See also CEIL / CEILING