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
What is field in mysql?
What does blob mean in mysql?
How do I flush privileges in mysql?
What are the column comparisons operators?
What is the difference between unix timestamp and mysql timestamp?
What are the advantages and disadvantages of using mysql?
How to display nth highest salary from a table in a mysql query?
Can we write pl sql mysql?
Does insert statement lock the table?
How do I restore a database in mysql workbench?
Is mysql connect deprecated?
What is mysql_connect?
How to create a new table in mysql?
What is RMS Migrations
how you will Create a database on the mysql server with unix shell.