YEAR Function

Returns the year from a date or datetime value.

Category: Date and Time
Returned data type: SMALLINT

Syntax

YEAR(date | datetime)

Arguments

date

specifies any valid expression that represents a date value.

Data type DATE
See <sql-expression>
FedSQL Expressions

datetime

specifies any valid expression that represents a datetime value.

Data type TIMESTAMP
See <sql-expression>
FedSQL Expressions

Example

Table: CUSTONLINE
The following statement illustrates the YEAR function:
Statements
Results
select year(endtime) from custonline;
2012
2012
2012
2012
2012
2013
2013
2013
2013
2013
select year(current_time);
2013
Last updated: February 23, 2017