MySQL 8.1
MAKETIME(hour, minute, second)Parameters
- hourINT
- Hours, can exceed 23 and be negative
- minuteINT
- Minutes from 0 to 59
- secondDECIMAL
- Seconds from 0 to 59, can be fractional
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.1
SELECT MAKETIME(12, 30, 45);Over a day with fractional seconds
MySQL 8.1
SELECT MAKETIME(100, 30, 45.5);Minutes out of range
MySQL 8.1
SELECT MAKETIME(12, 60, 0);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.