跳转到内容

将日期或带时间的日期(timestamp/datetime)向下取整到最近的星期一。 返回日期。

func.to_monday(<expr>)
func.to_monday('2023-11-12 09:38:18.165575')
┌────────────────────────────────────────────────────┐
│ func.to_monday('2023-11-12 09:38:18.165575') │
│ Date │
├────────────────────────────────────────────────────┤
│ 2023-11-06 │
└────────────────────────────────────────────────────┘
TO_MONDAY(<expr>)
参数 说明
<expr> 日期/时间戳

DATE,以“YYYY-MM-DD”格式返回日期。

SELECT
to_monday('2023-11-12 09:38:18.165575')
┌─────────────────────────────────────────┐
│ to_monday('2023-11-12 09:38:18.165575') │
│ Date │
├─────────────────────────────────────────┤
│ 2023-11-06 │
└─────────────────────────────────────────┘