MariaDB MAKETIME() Function
In MariaDB, MAKETIME()
is a built-in function that creates a time from given hours, minutes, and seconds.
MariaDB MAKETIME()
Syntax
This is the syntax of the MariaDB MAKETIME()
function:
MAKETIME(hour, minute, second)
Parameters
hour
-
Required. Hours.
minute
-
Required. Minutes, ranging from
0
to59
. second
-
Required. Seconds, ranging from
0
to59
.
If you provide no parameters or the wrong number of parameters, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'MAKETIME'
.
Return value
The MariaDB MAKETIME()
function return a time value from gaven hours, minutes, and seconds.
If is minute
not between 0
and 59
, the MAKETIME()
function will return NULL
.
If is second
not between 0
and 59
, the MAKETIME()
function will return NULL
.
The time range supported by MariaDB is from -838:59:59
to 838:59:59
.
MariaDB MAKETIME()
Examples
This statement shows the basic usage of the MariaDB MAKETIME()
function:
SELECT
MAKETIME(10, 11, 12),
MAKETIME(100, 11, 12),
MAKETIME(839, 11, 12),
MAKETIME(-999, 11, 12),
MAKETIME(10, 11, 12),
MAKETIME(10, 60, 12),
MAKETIME(10, 11, 75)\G
Output:
MAKETIME(10, 11, 12): 10:11:12
MAKETIME(100, 11, 12): 100:11:12
MAKETIME(839, 11, 12): 838:59:59
MAKETIME(-999, 11, 12): -838:59:59
MAKETIME(10, 11, 12): 10:11:12
MAKETIME(10, 60, 12): NULL
MAKETIME(10, 11, 75): NULL
Conclusion
In MariaDB, MAKETIME()
is a built-in function that creates a time from given hours, minutes, and seconds.