subtract two date [message #82478] |
Thu, 29 May 2003 10:22 |
Rishi
Messages: 63 Registered: January 2001
|
Member |
|
|
how can i subtract two date...suppose i want to know the difference between two dates interms of days/month/year how can i calculate it using select query...
|
|
|
|
Re: subtract two date [message #82538 is a reply to message #82494] |
Thu, 05 June 2003 07:49 |
NAFEES AHMED
Messages: 5 Registered: June 2003
|
Junior Member |
|
|
SUBSTRACT TWO DATE
IN RESPONSE YOU ARE QUERY
YOU CAN SUBSTRACT DATE FROM SYSTEM DATE AND THE HIREDATE OF EMP TABLE. DISPLAY THE RESULT IN NO OF DAYS BETWEEN TWO DATES.
RESULT IS:
SQL> SELECT SYSDATE-HIREDATE FROM EMP;
SYSDATE-HIREDATE
----------------
8571.77519
8506.77519
8504.77519
8465.77519
8286.77519
8436.77519
8397.77519
6257.77519
8236.77519
8306.77519
6223.77519
8220.77519
THE MONTHS_BETWEEN FUNCTION DISPLYA THE NUMBER OF MONTHS BETWEEN TWO DATES.
I HOPE THAT YOU ARE PROBLEM IS SOLVED.
THANKS.
|
|
|