Home » SQL & PL/SQL » SQL & PL/SQL » datediff
datediff [message #39090] Fri, 14 June 2002 05:56 Go to next message
Ravi
Messages: 251
Registered: June 1998
Senior Member
is there a datediff function in oracle similar to sybase, if yes,
please give an example and usage.

thanks
Re: datediff [message #39091 is a reply to message #39090] Fri, 14 June 2002 06:21 Go to previous message
Jon
Messages: 483
Registered: May 2001
Senior Member
There is a months_between function or you can just subtract the two dates to get the number of days between:

09:56:13 ==> select months_between('10/10/2001', '02/15/2002') from dual;
MONTHS_BETWEEN('10/10/2001','02/15/2002')
----------------------------------------
-4.16129
1* select to_date('10/10/2001')-to_date('02/15/2002') days_between from dual
10:07:58 ==> /

DAYS_BETWEEN
------------
-128
Previous Topic: Date, time
Next Topic: sqlloader rows successfully loaded (urgent)
Goto Forum:
  


Current Time: Thu Apr 18 18:09:29 CDT 2024