- Categories:
EXTRACT¶
Extracts the specified date or time part from a date, time, or timestamp.
Alternative for DATE_PART.
Syntax¶
EXTRACT( <date_or_time_part> FROM <date_or_time_expr> )
Usage Notes¶
date_or_time_part
must be one of the values listed in Supported Date and Time Parts.
Examples¶
SELECT EXTRACT(YEAR FROM TO_TIMESTAMP('2013-05-08T23:39:20.123-07:00')) AS v FROM (values(1)) v1; ------+ V | ------+ 2013 | ------+