MySQL CURDATE function explained

The MySQL CURDATE() function allows you to retrieve the current date (without the time section) of your MySQL server.

The function will return the date of the operating system that’s running your MySQL server instance.

You need to use the SELECT statement with the function as follows:

SELECT CURDATE();
--   +------------+
--   | curdate()  |
--   +------------+
--   | 2021-10-08 |
--   +------------+

The CURDATE() function is synonymous with the CURRENT_DATE() function and the CURRENT_DATE global variable.

You can use either one of them for retrieving the current date from your MySQL server:

SELECT CURDATE(), CURRENT_DATE(), CURRENT_DATE;

The output will be as shown below:

+------------+----------------+--------------+
| CURDATE()  | CURRENT_DATE() | CURRENT_DATE |
+------------+----------------+--------------+
| 2021-10-08 | 2021-10-08     | 2021-10-08   |
+------------+----------------+--------------+

And that will be all about MySQL CURDATE() function.

Take your skills to the next level ⚡️

I'm sending out an occasional email with the latest tutorials on programming, web development, and statistics. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.