Built-in Functions → yearMonth(date_timestamp exp)
yearMonth(date_timestamp exp) is a scalar date function that returns the year and month of a given date or timestamp column or expression as an integer. In the returned value, the first four digits represent the year while the last two digits represent the month.
Note
This function is available starting with release 2024.1.0.
Signature
yearMonth(date_timestamp exp)
Parameter | Description |
---|---|
date_timestamp exp | This can be a date or timestamp column or an expression that is evaluated to a date or timestamp value, such as date("2023-10-25") . |
Returns
int
Example
Function | Result |
---|---|
yearMonth(date("2023-10-25")) | 202310 . |
Note
When Null Handling is enabled, the function returns null
when the expression is evaluated to null
. If disabled, the function returns an inconsistent value.