Home > Database > Mysql Tutorial > How does the MySQL DATEDIFF() function work?

How does the MySQL DATEDIFF() function work?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-09-07 18:45:10
forward
825 people have browsed it

MySQL DATEDIFF() 函数如何工作?

MySQL DATEDIFF() function returns the number of days between two dates. The syntax of this function is as follows -

DATEDIFF(date1,date2)
Copy after login

For example, if we want to know the number of days between "2017-10-22" and "2017-09-21", then we can use the DATEDIFF() function as follows Show-

mysql> Select DATEDIFF('2017-10-22','2017-09-21') AS 'NUMBER OF DAYS';

+----------------+
| NUMBER OF DAYS |
+----------------+
|            31  |
+----------------+
1 row in set (0.00 sec)
Copy after login

The above is the detailed content of How does the MySQL DATEDIFF() function work?. For more information, please follow other related articles on the PHP Chinese website!

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