MariaDB CURRENT_DATE() Function

In MariaDB, CURRENT_DATE() is a built-in function that returns the system’s current date in YYYY-MM-DD or YYYYMMDD format.

It is a synonym for CURDATE.

MariaDB CURRENT_DATE() Syntax

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

CURRENT_DATE
CURRENT_DATE()

Parameters

MariaDB CURRENT_DATE() does not accept any parameters.

Return value

MariaDB CURRENT_DATE() returns the current date.

CURRENT_DATE() returns the current date in the YYYY-MM-DD format if in string context and returns the current date in YYYYMMDD format if in a numeric context.

MariaDB CURRENT_DATE() Examples

The following statement shows how to use the MariaDB CURRENT_DATE() function to return the current date of the system.

SELECT
    CURRENT_DATE(),
    CURRENT_DATE() + 0;

Output:

+----------------+--------------------+
| CURRENT_DATE() | CURRENT_DATE() + 0 |
+----------------+--------------------+
| 2023-01-06     |           20230106 |
+----------------+--------------------+

Note: CURRENT_DATE() + 0 is a numeric context, so the result is in YYYYMMDD format.

CURRENT_DATE() + N means adding a number to the current date. For example. To add 50 to the current date of the system:

SELECT CURRENT_DATE() + 0, CURRENT_DATE() + 50;

Output:

+--------------------+---------------------+
| CURRENT_DATE() + 0 | CURRENT_DATE() + 50 |
+--------------------+---------------------+
|           20230106 |            20230156 |
+--------------------+---------------------+

Conclusion

In MariaDB, CURRENT_DATE() is a built-in function that returns the system’s current date in YYYY-MM-DD or YYYYMMDD format.