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
Consider you have the following three tables which have to be linked together.
Is mysql an oracle product?
What is different between sql and mysql?
Why phpmyadmin is used for mysql?
Can we join 3 tables in mysql?
What is 'mysqldump'?
I want to find out all databases starting with ‘test’, I have access to?
How do I delete a table in mysql workbench?
How to see table's field formats or description of table .
What is a procedure example?
What is query log in mysql?
What is bigint in mysql?
What is difference between mysql mysqli and pdo?
What data type is money?
Write a command with which mysql table can be repaired