Get today's date in (YYYY-MM-DD) format in MySQL?


To get today’s date in (YYYY-MM-DD) format in MySQL, you can use CURDATE().

Following is the query to get the current date:

mysql> SELECT CURDATE();

This will produce the following output:

+------------+
| CURDATE()  |
+------------+
| 2019-04-09 |
+------------+
1 row in set (0.00 sec)

You can also use NOW() for this. Following is the query:

mysql> SELECT DATE(NOW());

This will produce the following output

+-------------+
| DATE(NOW()) |
+-------------+
| 2019-04-09  |
+-------------+
1 row in set (0.00 sec)

Updated on: 30-Jul-2019

3K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements