HOUR Function

Returns the hour from a time or datetime value.

Category: Date and Time
Returned data type: TINYINT

Syntax

HOUR(time | datetime)

Arguments

time

specifies any valid expression that represents a time value.

Data type TIME
See FedSQL Expressions

datetime

specifies any valid expression that represents a datetime value.

Data type TIMESTAMP
See FedSQL Expressions

Details

In Hive, when the HOUR function is used to search for a specific value, the function will fail if there is more than one column of type TIME in the table.

Example

The following statement illustrates the HOUR function:
Statements
Results
select hour(endtime) from custonline;
10
22
19
12
12
16
15
11
10
 9
select hour(current_time);
14