MAKETIME()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns a time value constructed from separate hour, minute, and second values.
USAGE
MAKETIME(hours, minutes, seconds)
Argument Name | Description |
---|---|
| The number representing the hours past midnight |
| The number of minutes past the hour |
| The number of seconds past the minute |
DETAILS
MAKETIME()
is a date-time function that returns a time value from separate arguments for hours, minutes, and seconds.
The seconds can be specified as a fractional value to specify sub-second precision.
In string context, the return value is in the hh:mm:ss
format. Fractional seconds are appended after a decimal point.
In numeric context, the return value is in the hhmmss
format. Fractional seconds transform the integer value into floating point.
A NULL
is returned if any argument is NULL
.
EXAMPLES
SELECT MAKETIME(10, 20, 30) AS result_1,
MAKETIME(10, 20, 30.40) AS result_2;
+-----------------+-----------------+
| result_1 | result_2 |
+-----------------+-----------------+
| 10:20:30.000000 | 10:20:30.000000 |
+-----------------+-----------------+
SELECT MAKETIME(10, 20, 30) + 0 AS result_1,
MAKETIME(10, 20, 30.40) + 0 AS result_2;
+-------------+-------------+
| result_1 | result_2 |
+-------------+-------------+
| 102030.0000 | 102030.0000 |
+-------------+-------------+
SELECT MAKETIME(10, 00, 61);
+----------------------+
| MAKETIME(10, 00, 61) |
+----------------------+
| NULL |
+----------------------+