MariaDB UTC_TIME() Function

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

UTC stands for Coordinated Universal Time, the world standard for regulating time.

MariaDB UTC_TIME() Syntax

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

UTC_TIME
UTC_TIME()
UTC_TIME(precision)

Parameters

precision

Optional. Fractional seconds precision.

Return value

The MariaDB UTC_TIME() function returns the current UTC time.

If the UTC_TIME() function is used in a string context, its return value is in 'hh:mm:ss' format; if it is used in a numeric context, its return value is in hhmmss format.

MariaDB UTC_TIME() Examples

Returns the current UTC time:

SELECT UTC_TIME(), UTC_TIME() + 0;

Output:

+------------+----------------+
| UTC_TIME() | UTC_TIME() + 0 |
+------------+----------------+
| 06:34:42   |          63442 |
+------------+----------------+

The MariaDB UTC_TIME() function allow you to specify the precision of fractional seconds:

SELECT UTC_TIME(1), UTC_TIME(6);

Output:

+-------------+-----------------+
| UTC_TIME(1) | UTC_TIME(6)     |
+-------------+-----------------+
| 06:34:53.7  | 06:34:53.768115 |
+-------------+-----------------+

Conclusion

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