Built-in Functions → yearQuarter(date_timestamp exp)

yearQuarter(date_timestamp exp) is a scalar date function that returns the year and quarter 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 quarter.

Note

This function is available starting with release 2024.1.0.

Signature

yearQuarter(date_timestamp exp)
ParameterDescription
date_timestamp expThis 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

FunctionResult
yearQuarter(date("2023-10-25"))202304.
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.