Dates & time
Scalar
year()
Extract the year component from a date or timestamp
Reference: DuckDB 2.0.0
Arguments & returns
4 overloadsyear(ts)
Scalar
Example
Haybarn WASM 2.0.0-rc12 · In your browser
Engine example · Run to view results.
In other engines
Apache Sparkyear()
YEAR('2021-03-01')
YEAR(CAST('2021-03-01' AS DATE))