MySQL Programming Question: Download Questions PDF
How To Calculate the Difference between Two Dates?
Answer:
If you have two dates, and you want to know how many days between them, you can use the DATEDIFF(date1, date2) function as shown below:
SELECT DATEDIFF(DATE('1997-02-28'), DATE('1997-03-01'))
FROM DUAL;
-1
SELECT DATEDIFF(DATE('1997-02-28'), DATE('1997-03-01'))
FROM DUAL;
-1
Download MySQL Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
How To Decrement Dates by 1 in MySQL? | How To Calculate the Difference between Two Time Values? |