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

MySQLMySQLi Database

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)
raja
Published on 29-Apr-2019 08:40:55
Advertisements