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

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

王林
Release: 2023-08-22 23:05:04
forward
825 people have browsed it

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)
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template