DAY_FLOOR
更新时间:2025-10-17
描述
将日期转化为指定的时间间隔周期的最近向下取整时刻。
语法
SQL
1DAY_FLOOR(<datetime>)
2DAY_FLOOR(<datetime>, <origin>)
3DAY_FLOOR(<datetime>, <period>)
4DAY_FLOOR(<datetime>, <period>, <origin>)
参数
| 参数 | 说明 |
|---|---|
<datetime> |
合法的日期表达式 |
<period> |
参数是指定每个周期有多少天组成 |
<origin> |
开始的时间起点,如果不填,默认是 0001-01-01T00:00:00 |
返回值
返回最近向下取整时刻的日期。
举例
SQL
1select day_floor("2023-07-13 22:28:18", 5);
Text
1+------------------------------------------------------------+
2| day_floor(cast('2023-07-13 22:28:18' as DATETIMEV2(0)), 5) |
3+------------------------------------------------------------+
4| 2023-07-12 00:00:00 |
5+------------------------------------------------------------+
