MariaDB UTC_DATE() Function

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

If the UTC_DATE() function is used in a string context, its return value is in 'YYYY-MM-DD' format; if it is used in a numeric context, its return value is in YYYYMMDD format.

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

MariaDB UTC_DATE() Syntax

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

UTC_DATE
UTC_DATE()

Return value

MariaDB UTC_DATE() function returns the current UTC date.

If the UTC_DATE() function is used in a string context, its return value is in 'YYYY-MM-DD' format; if it is used in a numeric context, its return value is in YYYYMMDD format.

MariaDB UTC_DATE() Examples

Returns the current UTC date:

SELECT
    UTC_DATE(),
    UTC_DATE() + 0;

Output:

+------------+----------------+
| UTC_DATE() | UTC_DATE() + 0 |
+------------+----------------+
| 2022-04-16 |       20220416 |
+------------+----------------+

Note: The result of UTC_DATE() + 0 is in YYYYMMDD format.

UTC_DATE() + N means to add N to the number of the current date:

SELECT UTC_DATE(), UTC_DATE() + 100;

Output:

+------------+------------------+
| UTC_DATE() | UTC_DATE() + 100 |
+------------+------------------+
| 2023-01-12 |         20230212 |
+------------+------------------+

Conclusion

In MariaDB, UTC_DATE() is a built-in function that returns the current UTC date. If the UTC_DATE() function is used in a string context, its return value is in 'YYYY-MM-DD' format; if it is used in a numeric context, its return value is in YYYYMMDD format.