Function Reference

MAKETIME

PostgreSQL equivalent:

Returns a time built from hours, minutes and seconds.

MySQL 8.4
MAKETIME(hour, minute, second)
hour
Hours, can exceed 23 and be negative
INT
minute
Minutes from 0 to 59
INT
second
Seconds from 0 to 59, can be fractional
DECIMAL

Return value

A time (TIME) from -838:59:59 to 838:59:59, hours can exceed 23; NULL if minutes or seconds are outside the range from 0 to 59

Examples

Time from hours, minutes and seconds

MySQL 8.4
SELECT MAKETIME(12, 30, 45);
MAKETIME(12, 30, 45)
12:30:45

Over a day with fractional seconds

MySQL 8.4
SELECT MAKETIME(100, 30, 45.5);
MAKETIME(100, 30, 45.5)
100:30:45.5

Minutes out of range

MySQL 8.4
SELECT MAKETIME(12, 60, 0);
MAKETIME(12, 60, 0)
<NULL>

Details

The result is a TIME value, and this type has a limit: hours above 838 are clipped, MAKETIME(900, 0, 0) returns 838:59:59 with a warning.

See also