跳转到内容

将带时间的日期(timestamp/datetime)向下取整到秒的起点。

func.to_start_of_second(<expr>)
func.to_start_of_second('2023-11-12 09:38:18.165575')
┌────────────────────────────────────────────────────────────────┐
│ func.to_start_of_second('2023-11-12 09:38:18.165575') │
│ Timestamp │
├────────────────────────────────────────────────────────────────┤
│ 2023-11-12 09:38:18 │
└────────────────────────────────────────────────────────────────┘
TO_START_OF_SECOND(<expr>)
参数 说明
<expr> timestamp

TIMESTAMP,返回“YYYY-MM-DD hh:mm:ss.ffffff”格式的日期。

SELECT
to_start_of_second('2023-11-12 09:38:18.165575')
┌──────────────────────────────────────────────────┐
│ to_start_of_second('2023-11-12 09:38:18.165575') │
│ Timestamp │
├──────────────────────────────────────────────────┤
│ 2023-11-12 09:38:18 │
└──────────────────────────────────────────────────┘