How can we find the number of day's between any two given date's by using the dual table only?

Showing Answers 1 - 24 of 24 Answers

select trunc (to_date('2005/04/18 11:05:00','YYYY/MM/DD HH24:MI:SS')-
to_date('2005/04/15 10:15:32','YYYY/MM/DD HH24:MI:SS')) as days from dual;

This may help you.

  Was this answer useful?  Yes

budzboy

  • Jul 14th, 2010
 

SELECT ABS(to_date(date1,date1format) - to_date(date2,date2format)) FROM dual;

Where date1format and date2format are the date formats of date1 and date2;
Example:

SELECT ABC(to_date('01-01-2008','MM-DD-RRRR') - to_date('01-JUN-1999','DD-MON-RRRR')) FROM dual;
 

  Was this answer useful?  Yes

naveen_g45

  • Aug 10th, 2010
 

select months_between(sysdate,hire_date) from employees

  Was this answer useful?  Yes

naveen_g45

  • Aug 10th, 2010
 

select months_between('10-aug-2010','01-feb-1989') as numberofdays from dual

  Was this answer useful?  Yes

Use below query to find number of days between two given dates -

SQL> select to_date('30-aug-2010','dd-mon-rrrr') - to_date('20-aug-2010','dd-mon-rrrr') num_days from dual;
NUM_DAYS
----------
10
SQL>


  Was this answer useful?  Yes

saishradha

  • Aug 12th, 2010
 

Below is the correct query according to me..


select to_date('19-aug-2010', 'dd-mon-yyyy') - to_date('10-aug-2010', 'dd-mon-yyyy') as numberofdays from dual;


Let me know if it does not work..


Sairam..

 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions