year
Returns the year field from a date value.
Example
year(timestamp("2001-12-24 23:55:12.000"))
The result is 2001
Syntax
year(timestamp expr t)
Parameters
- t: expression evaluating to
timestamp
Returns
int
Notes
year
returns the value of the year field from a timestamp
or string
value. If the argument is a string
, the format should be “yyyy-MM-dd HH:mm:ss”.