TIME
- TIME(hours, minutes, seconds)[source]
Constructs a time value from hour, minute, and second components.
The TIME function creates a valid time based on the provided hours, minutes, and seconds. It can operate element-wise if any of the inputs are arrays, producing a corresponding array of time values.
- Parameters:
hours (
Operand|int) –The hours component of the time (0–23).
Supported types:
INTEGER
INTEGER_ARRAY
minutes (
Operand|int) –The minutes component of the time (0–59).
Supported types:
INTEGER
INTEGER_ARRAY
seconds (
Operand|int) –The seconds component of the time (0–59).
Supported types:
INTEGER
INTEGER_ARRAY
- Return type:
- Returns:
A Formula object representing the constructed time. The result is an array if any input is an array; otherwise, it is a scalar. If the inputs do not form a valid time, the formula will evaluate to an error.
Supported types:
TIME
TIME_ARRAY
- Raises:
ValueError – If any of the inputs are not integers or integer arrays.
Examples
Basic usage:
TIME(14, 30, 0) # Returns a time representing 14:30:00
Using arrays:
TIME([9, 12, 15], [0, 30, 45], [0, 0, 30]) # Returns TIME_ARRAY with [09:00:00, 12:30:00, 15:45:30]