Parameter | Type |
---|---|
value | datetime, date, datetimestamp, gyear, gyearmonth |
Returns: integer
Example
query:
SELECT YEAR(CAST("2018-01-02" AS DATE))
results:
year |
---|
2,018 |
The date function used to return the year value of a date, time, or datetime value.
Parameter | Type |
---|---|
value | datetime, date, datetimestamp, gyear, gyearmonth |
query:
SELECT YEAR(CAST("2018-01-02" AS DATE))
results:
year |
---|
2,018 |
AT_TIME_ZONE
, DATE_ADD
, DATE_COMPARE
, DATE_DIFF
, DATE_FORMAT
, DATE_PARSE
, DATE_PART
, DATE_SUB
, DATE_TRUNC
, DAY
, HOURS
, MINUTES
, MONTH
, NOW
, SECONDS