What is the difference between MySQL NOW() and CURDATE() function?



As the name suggests CURDATE() function will return the current date. In simple words, we can say that it would return only the date not time.

mysql> select CURDATE();
+------------+
| CURDATE()  |
+------------+
| 2017-10-28 |
+------------+
1 row in set (0.00 sec)

In contrast, NOW() function will return current date and time.

mysql> Select NOW();
+---------------------+
| NOW()               |
+---------------------+
| 2017-10-28 09:10:16 |
+---------------------+
1 row in set (0.00 sec)

Advertisements