

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# FLOOR
<a name="sql-reference-floor"></a>

```
FLOOR ( <time-unit> )
```

当使用数字参数调用时，FLOOR 将返回等于或小于输入参数的最大整数。

当与日期、时间或时间戳表达式一起调用时，FLOOR 将返回小于或等于输入的最大值，取决于 <time unit> 指定的精度。

如果任何输入参数为 null，则 FLOOR 返回 null。

## 示例
<a name="sqlref-floor-examples"></a>


|  函数  |  结果  | 
| --- | --- | 
|  FLOOR(2.0)  |  2  | 
|  FLOOR(-1.0)  |  –1  | 
|  FLOOR(5.2)  |  5  | 
|  FLOOR(-3.3)  |  -4  | 
|  FLOOR(-3 \$1 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 MINUTE)  |  TIMESTAMP '2004-09-30 13:48: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'  | 

## 注意
<a name="sqlrf-floor-notes"></a>

**注意**  
FLOOR ( <datetime expression> TO <timeunit> ) 是 Amazon Kinesis Data Analytics 扩展。  
STEP 函数与 FLOOR 类似，但可以将值舍入为任意间隔，例如 30 秒。有关更多信息，请参阅 [STEP](sql-reference-step.md)。