HOURSBETWEEN
- HOURSBETWEEN(first_time, second_time)[source]
Returns the number of hours between two times or arrays of times.
The HOURSBETWEEN function calculates the difference in hours between first_time and second_time. The result is positive if second_time occurs after first_time and negative if it occurs before. This function supports both single times and arrays of times. The return value is a decimal or decimal array representing the hour difference.
- Parameters:
first_time (
Operand) – The starting time or date time.second_time (
Operand) – The ending time or date time.
- Return type:
- Returns:
The number of hours between the two times. If input arrays have unequal lengths the returned formula will evaluate to an error.
- Raises:
ValueError – If either input is not a valid type.
Examples
HOURSBETWEEN(TIME(14, 30, 0), DATE(16, 0, 0)) # Returns 1.5
``first_time`` — accepted types
DATE
DATETIME
DATETIME_ARRAY
DATE_ARRAY
TIME
TIME_ARRAY
``second_time`` — accepted types
DATE
DATETIME
DATETIME_ARRAY
DATE_ARRAY
TIME
TIME_ARRAY
Return types
DECIMAL
DECIMAL_ARRAY