Built-in Functions → year

year() is a scalar date function that returns the year component from a date or timestamp value. If the argument is a string, the format should be "yyyy-MM-dd HH:mm:ss".

Syntax

year(date exp)

The following table illustrates the year() parameter: | Parameter | Description | |-|-| | date exp | an expression evaluating to timestamp |

Returns

int

Example

year(timestamp("2001-12-24 23:55:12.000"))

The result is 2001