MySQL MAKETIME() Function
In MySQL, the MAKETIME()
function creates a time based on the specified hour, minute, and second to and returns it.
MAKETIME()
Syntax
Here is the syntax of MySQL MAKETIME()
function:
MAKETIME(hour, minute, second)
Parameters
hour
- Required. Hour, ranging from
-838
to838
. minute
- Required. Minutes, ranging from
0
to59
. second
- Required. Seconds, ranging from
0
to59
.
Return value
The MySQL MAKETIME()
function creates a time based on the specified hour, minute, and second to and returns it.
- If is
minute
not between0
to59
, theMAKETIME()
function will returnNULL
. - If is
second
not between0
to59
, theMAKETIME()
function will returnNULL
.
Note: MySQL supports the time range from -838:59:59
to 838:59:59
.
MAKETIME()
Examples
Here are some examples of the 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
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