Skip to main content

TO_YYYYMM

将日期或带时间的日期(时间戳/日期时间)转换为包含年份和月份编号的 UInt32 数字。

语法

TO_YYYYMM(<expr>)

参数

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

返回类型

INT,返回格式为 YYYYMM

示例

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

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