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 do I get a list of table names in mysql?
Can I use mysql for free?
How to returns the columns and column information pertaining to the designated table.
Which is better sqlite or mysql?
What do ddl, dml, and dcl stand for?
What is pdo connection?
Explain about reporting services of MYSQL?
How can you plan the logshipping before processing?
What is mysql installer?
How do stored procedures work?
What are the advantages and disadvantages of using mysql?
what is constraints? Also explain the different types of constraints?
What is mysql command line?
What does mysql_fetch_assoc do?
What's the difference between mysql and sql server?