MAKE_TIME

Construct a TIME value from hour, minute, and second components.

Category: datetimeReturns: TIMEDialect: PostgreSql

Syntax

MAKE_TIME(hour, min, sec)

Description

## Overview Constructs a TIME value from separate hour, minute, and second components. The second component accepts fractional values for sub-second precision. Use MAKE_TIME when time components are stored in separate columns (for example shift schedules, recurring events) and you need to assemble them into a TIME value for comparison or concatenation with a date. ## Behavior - Returns a TIME WITHOUT TIME ZONE. - Returns NULL if any argument is NULL. - Raises an error for out-of-range values: hour outside 0-23, minute outside 0-59, seconds outside 0 through 60 (exclusive). - Fractional seconds are preserved up to the configured precision (typically microsecond). - Hour 24 is not accepted; midnight is represented as hour 0 on the following day. ## Compatibility - Matches the MAKE_TIME convention used across analytical SQL engines.

Parameters

NameTypeDescription
hourSpecifies the hour component as an INTEGER in the range 0 through 23.
minSpecifies the minute component as an INTEGER in the range 0 through 59.
secSpecifies the seconds component as a DOUBLE in the range 0.0 through 59.999..., including fractional seconds.

Examples

-- Afternoon time: 14:30:00
SELECT MAKE_TIME(14, 30, 0) AS t;
-- Midnight
SELECT MAKE_TIME(0, 0, 0) AS t;
-- Time with fractional seconds
SELECT MAKE_TIME(9, 15, 30.5) AS t;
-- Build shift-start times from scheduling columns
SELECT shift_id, MAKE_TIME(shift_hour, shift_minute, 0) AS shift_start
FROM workforce.scheduling.shifts;
-- Combine MAKE_DATE and MAKE_TIME to produce a TIMESTAMP
SELECT (MAKE_DATE(2025, 3, 15) + MAKE_TIME(14, 30, 0))::TIMESTAMP AS ts;
-- Error case: hour 25 is invalid
SELECT MAKE_TIME(25, 0, 0); -- raises an error

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →