TIME()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Returns the time part of a time-containing expression.
USAGE
TIME(expr)
Argument Name | Description |
---|---|
| The time-containing expression to evaluate |
DETAILS
TIME()
is a date-time function that returns the time portion of a time-containing expression.
When the argument is a string, it can have a DATETIME
format of YYYY-MM-DD hh:mm:ss
or a TIME
format of hh:mm:ss
(and similar). Both support optional fractional seconds after a decimal point with up to 6 digits of accuracy.
When the argument is numeric, it can be an integer or floating-point number with the integer portion in the format HHMMSS
.
When a time is specified without a date, it is OK for the hours portion of the value to exceed 24.
In string context, the return value is in the hh:mm:ss.uuuuuu
format. The 6-digit microsecond value is always included after the decimal point, even if no microseconds were specified in an input value.
In numeric context, the return value is in the hhmmss.us
format. The value is always floating point, even when microseconds were not specified in the input.
A NULL
is returned if argument is NULL
.
EXAMPLES
SELECT TIME('2019-01-31 10:01:00');
+-----------------------------+
| TIME('2019-01-31 10:01:00') |
+-----------------------------+
| 10:01:00.000000 |
+-----------------------------+
SELECT TIME('12:34:56') + 0;
+----------------------+
| TIME('12:34:56') + 0 |
+----------------------+
| 123456.0000 |
+----------------------+