Returns the number of hours (Number
value) represented by the given duration of time.
Sample usage
HOUR("007:14:21")
: 7
HOUR(TIMENOW() - "00:00:00")
returns hours since midnight; the current hour of the day. See also: TIMENOW()
HOUR((TODAY() + 1) - NOW())
returns hours until midnight. See also: NOW()
, TODAY()
.
HOUR((DATETIME(TODAY() + 1) + "009:00:00") - NOW())
returns hours until 9:00 AM tomorrow. See also: DATETIME()
HOUR([Event Time] - NOW())
returns hours until the event time.
HOUR([Event Time] - [_THISROW].[Event Time])
returns hours between two event times.
Common problems
HOUR(NOW())
(or any DateTime
or Time
value in place of NOW()
) causes Expression Assistant to complain, Parameter 1 of function HOUR is of the wrong type
. The argument must be a Duration
value, not a DateTime
or Time
value. To fix, convert a DateTime
value to a Time
value with TIME()
, then subtract a zero time to convert a Time
value to a Duration
value: HOUR(TIME(NOW()) - "00:00:00")
. See also: NOW()
, TIME()
Syntax
HOUR(duration)
duration
- ADuration
value.
Notes
HOUR(...)
is equivalent to (NUMBER(INDEX(SPLIT(TEXT(...), ":"), 1)) + 0)
when ...
is a Time
value. See also: INDEX()
, NUMBER()
, SPLIT()
, TEXT()
.