MariaDB UTC_TIMESTAMP() Function

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

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

MariaDB UTC_TIMESTAMP() Syntax

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

UTC_TIMESTAMP
UTC_TIMESTAMP()
UTC_TIMESTAMP(precision)

Parameters

precision

Optional. Fractional seconds precision.

Return value

The MariaDB UTC_TIMESTAMP() function return the current UTC date and time.

If the UTC_TIMESTAMP() function is used in a string context, its return value is in 'YYYY-MM-DD hh:mm:ss' format; if it is used in a numeric context, its return value is in YYYYMMDDhhmmss.uuuuuu format.

MariaDB UTC_TIMESTAMP() Examples

Returns the current UTC date and time:

SELECT UTC_TIMESTAMP(), UTC_TIMESTAMP() + 0;

Output:

+---------------------+---------------------+
| UTC_TIMESTAMP()     | UTC_TIMESTAMP() + 0 |
+---------------------+---------------------+
| 2023-01-12 06:39:51 |      20230112063951 |
+---------------------+---------------------+

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

SELECT UTC_TIMESTAMP(1), UTC_TIMESTAMP(6);

Output:

+-----------------------+----------------------------+
| UTC_TIMESTAMP(1)      | UTC_TIMESTAMP(6)           |
+-----------------------+----------------------------+
| 2023-01-12 06:40:01.4 | 2023-01-12 06:40:01.468817 |
+-----------------------+----------------------------+

Conclusion

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