Skip to main content

TO_START_OF_MONTH

将日期或带时间的日期(时间戳/日期时间)向下舍入到该月的第一天。 返回日期。

语法

TO_START_OF_MONTH(<expr>)

参数

参数描述
<expr>日期/时间戳

返回类型

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

示例

SELECT
to_start_of_month('2023-11-12 09:38:18.165575');

┌─────────────────────────────────────────────────┐
│ to_start_of_month('2023-11-12 09:38:18.165575')
├─────────────────────────────────────────────────┤
2023-11-01
└─────────────────────────────────────────────────┘
Explore Databend Cloud for FREE
Low-cost
Fast Analytics
Easy Data Ingestion
Elastic Scaling
Try it today