year
datetimeExtracts the year from a date or timestamp
Syntax
year(date) Parameters
date (date|timestamp) The date value to extract the year from
Returns
number The year as a four-digit number
Examples
Input:
year("2024-03-15") Output:
2024 Get the current year
Input:
year(now()) Output:
2025 The year() function extracts the year component from a date or timestamp value.
Usage
Use year() to group data by year, filter records by time period, or extract temporal components for analysis.