Home >Database >Mysql Tutorial >What is the difference between MySQL NOW() and CURDATE() functions?

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

王林
王林forward
2023-08-22 23:05:04860browse

MySQL NOW()和CURDATE()函数之间有什么区别?

As its name suggests, the CURDATE() function will return the current date. Simply put, it only returns the date, not the time.

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

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

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

The above is the detailed content of What is the difference between MySQL NOW() and CURDATE() functions?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete