MariaDB CURRENT_TIME() Function

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

CURRENT_TIME() is a synonym for CURTIME().

MariaDB CURRENT_TIME() Syntax

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

CURRENT_TIME
CURRENT_TIME([precision])

Parameters

precision

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

Return value

MariaDB CURRENT_TIME() returns the current time.

CURRENT_TIME() returns the current date in the HH:MM:SS format if in a string context and it returns the current date in HHMMSS.uuuuuu format if in a numeric context.

MariaDB CURRENT_TIME() Examples

Example 1

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

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

Output:

   CURRENT_TIME: 02:08:03
 CURRENT_TIME(): 02:08:03
CURRENT_TIME(1): 02:08:03.4
CURRENT_TIME(3): 02:08:03.440
CURRENT_TIME(6): 02:08:03.440556

Example 2 - Numeric Context

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

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

Output:

+--------------+------------------+---------------------+
| CURRENT_TIME | CURRENT_TIME + 0 | CURRENT_TIME(6) + 0 |
+--------------+------------------+---------------------+
| 02:09:20     |            20920 |        20920.635115 |
+--------------+------------------+---------------------+

Conclusion

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