EXTRACT function
EXTRACT( fm FROM e)
gets value from a timestamp;
fm is a format; e is a timestamp expression.
Format and the EXTRACT
Function
Keyword | DATE | TIME STAMP | TIME STAMP WITH TIME ZONE | TIME STAMP WITH LOCAL TIME ZONE | INTERVAL YEAR TO MONTH | INTERVAL DAY TO SECOND |
---|---|---|---|---|---|---|
YEAR | X | X | X | X | X | - |
MONTH | X | X | X | X | X | - |
DAY | X | X | X | X | - | X |
HOUR | - | X | X | X | - | X |
MINUTE | - | X | X | X | - | X |
SECOND | - | X | X | X | - | X |
TIMEZONE_HOUR | - | - | X | local session time zone data | - | - |
TIMEZONE_MINUTE | - | - | X | local session time zone data | - | - |
TIMEZONE_REGION | - | - | X | local session time zone data | - | - |
TIMEZONE_ABBR | - | - | X | local session time zone data | - | - |
SELECT EXTRACT(MINUTE FROM TO_TIMESTAMP('2012-12-11 12:13:14','RRRR-MM-DD HH24:MI:SS')) "Minute"
FROM DUAL;