- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How MySQL DATEDIFF() function works?
MySQL DATEDIFF() function returns the number of days between two dates. The syntax of this function is as follows −
DATEDIFF(date1,date2)
For example, if we want to know a number of days between dates say ‘2017-10-22’ and ‘2017-09-21’ then we can use DATEDIFF() function as follows −
mysql> Select DATEDIFF('2017-10-22','2017-09-21') AS 'NUMBER OF DAYS'; +----------------+ | NUMBER OF DAYS | +----------------+ | 31 | +----------------+ 1 row in set (0.00 sec)
- Related Articles
- How EXPORT_SET() function works in MySQL?
- How can we ignore the negative values return by MySQL DATEDIFF() function?
- How can I use 2-digit year value in MySQL DATEDIFF() function?
- In MySQL, how IN() comparison function works?
- How does MYSQL control flow function CASE works?
- How variable scope works in Python function?
- What MySQL returns if we include time components along with date component as an argument to DATEDIFF() function?
- Explain how the logistic regression function works with Tensorflow?
- How JVM works?
- How "getElementByID" works in JavaScript?
- How scriptblock works in PowerShell?
- How does digital thermometer works?
- Explain how a rocket works.
- How do Python Dictionary Searching works?
- How does JavaScript focus() method works?

Advertisements