This function is used to return the hour (from 0 to 23) of a specified time.
hour(string date)
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
date |
Yes |
DATE or STRING |
Date that needs to be processed The following formats are supported:
|
The return value is of the INT type.
The value 10 is returned.
select hour('2023-08-10 10:54:00');
The value 12 is returned.
select hour('12:00:00');
The value NULL is returned.
select hour('20230810105600');
The value NULL is returned.
select hour(null);