How can we know the number of days between two given dates
using MySQL?
Answer Posted / sergii
DATEDIFF(expr1,expr2)
DATEDIFF() returns expr1 – expr2 expressed as a value in
days from one date to the other. expr1 and expr2 are date
or date-and-time expressions. Only the date parts of the
values are used in the calculation.
mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
-> 1
mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
-> -31
| Is This Answer Correct ? | 9 Yes | 1 No |
Post New Answer View All Answers
How to declare variable in mysql trigger?
What are date and time functions in mysql?
Which is better mysql or mssql?
Does uninstalling mysql delete database?
What is mysql and how it works?
What are the objects can be created using CREATE statement?
What is the data type for image?
How to insert html code into mysql database using php?
What is data type for image in mysql?
What is mysql server?
How do I save in mysql?
What is the return type of mysqli_query?
How do I completely remove mysql from windows?
How to enter numeric values as hex numbers?
Explain timestamp?