Categories:
Date & Time Functions

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

Examples

SELECT EXTRACT(YEAR FROM TO_TIMESTAMP('2013-05-08T23:39:20.123-07:00')) AS v
    FROM (values(1)) v1;

------+
   V  |
------+
 2013 |
------+