EXTRACT Function

EXTRACT returns some time component from a time-based value, such as the year from a Timestamp.

Signatures 

EXTRACT ( YEAR MONTH DAY HOUR MINUTE SECOND FROM val )
Parameter Type Description
val date, timestamp, timestamptz The value from which you want to extract a component.

Return value 

EXTRACT returns a float value.

Examples 

SELECT EXTRACT(SECOND FROM TIMESTAMP '2006-01-02 15:04:05.06') AS sec_extr;
 sec_extr
----------
     5.06