MariaDB CURDATE() Function

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

It is a synonym for CURRENT_DATE and CURRENT_DATE().

MariaDB CURDATE() Syntax

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

CURDATE()

Parameters

MariaDB CURDATE() does not accept any parameters.

Return value

The MariaDB CURDATE() function returns the current date.

CURDATE() 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 CURDATE() Examples

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

SELECT
    CURDATE(),
    CURDATE() + 0;

Output:

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

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

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

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

Output:

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

Conclusion

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