- Categories:
HOUR / MINUTE / SECOND¶
Extracts the corresponding time part from a time, interval, or timestamp value.
These functions are alternatives to using the DATE_PART (or EXTRACT) function with the equivalent time part (see Supported date and time parts).
Syntax¶
Arguments¶
time_interval_or_timestamp_exprA time, an interval, or a timestamp, or an expression that can be evaluated to one of those data types. An interval argument must be a day and time interval, not a year and month interval.
Returns¶
This function returns a value of type NUMBER.
Usage notes¶
Function name |
Time part extracted from time, interval, or timestamp |
Possible values |
|---|---|---|
HOUR |
Hour of the specified day |
0 to 23 |
MINUTE |
Minute of the specified hour |
0 to 59 |
SECOND |
Second of the specified minute |
0 to 59 |
Tip
To extract a full TIME value from a TIMESTAMP value instead of a part, you can cast the TIMESTAMP value to a TIME value. For example:
Examples¶
This example demonstrates the HOUR, MINUTE, and SECOND functions:
For more examples, see Working with date and time values.