tell me the Date Diff function in Oracle

# Thread: tell me the Date Diff function in Oracle

#### Hybrid View

1. Junior Member
Join Date
Mar 2001
Posts
6
Hi Guys,

I wanna difference of two dates. How can i do woth Oracle...
Help Me soon...

Thanx for advance guys...

With
Venkat

2. Junior Member
Join Date
Mar 2001
Posts
17
You can use INTERVAL function.
This function Subtracts one datetime from another and generates the result.
When you add or subtract one interval from another, the result
is always another interval. You can multiply or divide an interval
by a numeric constant.
e.g.1
SELECT sysdate - INTERVAL '8' MONTH FROM DUAL;
Returns the following result:
SYSDATE-I
---------
28-JUL-00

e.g.2
SELECT sysdate - INTERVAL '8' day FROM DUAL;
Returns the following result:
SYSDATE-I
---------
20-MAR-01

e.g.3
SELECT sysdate - INTERVAL '8' year FROM DUAL;
Returns the following result:
SYSDATE-I
---------
28-MAR-93

OR
you can directly subtract one date from another to get difference but you need to
multiply or divide by a proper numeric constant.

Hope this will solve your problem

3. By subtracting two dates, you will get the difference in days. For example,
system@dev815nt.us> l
1 select sysdate - to_date('01/01/2001','mm/dd/yyyy') days
2* from dual
system@dev815nt.us> /

DAYS
----------
86.3983333

4. Junior Member
Join Date
Mar 2001
Posts
5

## date diff

You could use the months_between function

for example

select months_between(sysdate,'12-aug-00') from dual;

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•

Click Here to Expand Forum to Full Width