Which date function is used to find the difference between two dates

MONTHS_BETWEEN(date2,date1)
Gives date2 minus date1 in months.

SELECT MONTHS_BETWEEN(sysdate,Birthdate)/12 as Age
  FROM Birthday;

It calculate person's age.

 
SELECT trunc(date1-date2) 
   FROM dual;

Returns no of days

No comments:

Post a Comment