Extracts the corresponding time part from a time 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).
HOUR( <time_or_timestamp_expr> ) MINUTE( <time_or_timestamp_expr> ) SECOND( <time_or_timestamp_expr> )
Copy
Arguments¶time_or_timestamp_expr
A time or a timestamp, or an expression that can be evaluated to a time or a timestamp.
This function returns a value of type NUMBER.
Usage notes¶Function name
Time part extracted from time 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
Examples¶This example demonstrates the HOUR, MINUTE, and SECOND functions:
SELECT '2025-04-08T23:39:20.123-07:00'::TIMESTAMP AS tstamp, HOUR(tstamp) AS "HOUR", MINUTE(tstamp) AS "MINUTE", SECOND(tstamp) AS "SECOND";
Copy
+-------------------------+------+--------+--------+ | TSTAMP | HOUR | MINUTE | SECOND | |-------------------------+------+--------+--------| | 2025-04-08 23:39:20.123 | 23 | 39 | 20 | +-------------------------+------+--------+--------+
For more examples, see Working with date and time values.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4