Home » Developer & Programmer » Forms » subtract two date
subtract two date [message #82478] Thu, 29 May 2003 10:22 Go to next message
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 #82494 is a reply to message #82478] Fri, 30 May 2003 05:39 Go to previous messageGo to next message
M .I .khan
Messages: 1
Registered: May 2003
Junior Member
hi rishi
ur query is here
select months_between(system_date,date_of_birth)/12
from dual.

others is joulean meathod.........
Re: subtract two date [message #82538 is a reply to message #82494] Thu, 05 June 2003 07:49 Go to previous message
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.
Previous Topic: Order of firing
Next Topic: scrollbar
Goto Forum:
  


Current Time: Fri Apr 26 08:30:06 CDT 2024