MariaDB CURTIME() Function

In MariaDB, CURTIME() is a built-in function that returns the current time.

CURTIME() is a synonym for CURRENT_TIME().

MariaDB CURTIME() Syntax

This is the syntax of the MariaDB CURTIME() function:

CURTIME([precision])

Parameters

precision

Optional. The precision of fractional seconds. From 1 to 6.

Return value

MariaDB CURTIME() returns the current time.

CURTIME() returns the current time in the HH:MM:SSformat in a string context and returns the current time in HHMMSS.uuuuuu format in a numeric context.

MariaDB CURTIME() Examples

Example 1

The following statement shows the basic usage of the MariaDB CURTIME() function:

SELECT
    CURTIME(),
    CURTIME(1),
    CURTIME(3),
    CURTIME(6)\G

Output:

 CURTIME(): 02:16:56
CURTIME(1): 02:16:56.9
CURTIME(3): 02:16:56.995
CURTIME(6): 02:16:56.995154

Example 2 - Numeric Context

If in a numeric context, the resulting time is in the HHMMSS.uuuuuu format.

SELECT
    CURTIME() + 0,
    CURTIME(6) + 0;

Output:

+---------------+----------------+
| CURTIME() + 0 | CURTIME(6) + 0 |
+---------------+----------------+
|         21732 |   21732.446758 |
+---------------+----------------+

Conclusion

In MariaDB, CURTIME() is a built-in function that returns the current time.