Extracts a single specified full ANSI SQL:2011 field from any DateTime or Interval value, converting it to an exact numeric value.
Syntax
EXTRACT (
{ YEAR | MONTH | DAY | HOUR | MINUTE |
SECOND | TIMEZONE_HOUR | TIMEZONE_MINUTE
} FROM value
)
- YEAR
- The integer value for YEAR to be extracted from the date represented by value.
- MONTH
- The integer value for MONTH to be extracted from the date represented by value.
- DAY
- The integer value for DAY to be extracted from the date represented by value.
- HOUR
- The integer value for HOUR to be extracted from the date represented by value.
- MINUTE
- The integer value for MINUTE to be extracted from the date represented by value.
- TIMEZONE_HOUR
- The integer value for TIMEZONE_HOUR to be extracted from the date represented by value.
- TIMEZONE_MINUTE
- The integer value for TIMEZONE_MINUTE to be extracted from the date represented by value.
- SECOND
- The integer and decimal values for SECOND are to be extracted from the date represented by value. The returned value has a data type of DECIMAL(8,2).
- value
- An expression that results in a DateTime, Interval, or UDT value.