hour(X)

Returns the hour portion of a time-related value.

Syntax

hour(X)

Input

Argument Type Description
X any numeric type A scalar value or the name of a column containing time-related values
Valid values can be of the form:
  • time
  • date+time

For more information, see Dates and time.

Return Value

Returns the integer value corresponding to the hour portion of the time-related value given as input.

If the input values are not in one of the supported formats listed above, the function returns an erroneous or illogical output.

Example

The following example gets the login date and time using the logindatetime(X) function and then uses the hour(X) function to get the hour portion of it.

<base table="default.lonely" label="Example: hour(X)"/>
<willbe name="login_date_time" value="logindatetime(-5)" 
 label="Login Date/Time" format="type:datehms24"/>
<willbe name="login_hour" value="hour(login_date_time)" 
 label="Login Hour"/>
<colord cols="login_date_time,login_hour"/>