Skip to main content

TO_YYYYMM

Converts a date or date with time (timestamp/datetime) to a UInt32 number containing the year and month number.

Syntax

TO_YYYYMM(<expr>)

Arguments

ArgumentsDescription
<expr>date/timestamp

Return Type

INT, returns in YYYYMM format.

Examples

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

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