var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: days between two dates
I want TO find the NUMBER OF days BETWEEN two dates.
WHEN i used datediff FUNCTION i got an error LIKE
How TO overcome the above error??
IS there ANY other FUNCTION TO find the days BETWEEN two dates??
i tried the below on suggestion
TO_DAYS( laterDate ) - TO_DAYS( earlierDate ) as days_difference
and now getting error like "to_days" as invalid column
Re: days between two dates
select laterDate - earlierDate as days_difference from dual;
TO find months between 2 dates,
months_between(x,y) -- Returns a number of months between
y and x as produced by y-x. Can
return a decimal value.
Using this U can get NUMBER OF days BETWEEN two dates
SELECT ROUND(MONTHS_BETWEEN(sysdate,'01-Nov-03')*30) FROM DUAL;
o/p is less??
will u verify my procedure??
select tr_date into d1 from tst
where id = 'B2';
select tr_date into d2 from tst
where id = 'B3';
nn := d2 - d1;
here my first date is '15-NOV-03'
and second date is '20-NOV-03'.
But the o/p im getting is 4.
Is the answer correct?Why shouldnt be it 5.?
Re: o/p is less??
Probably your tr_date values have a time component, and are in fact less than 4.5 days apart, so round to 4 when converted to integer. For example they may be:
These are 4 days and 6 hours apart, i.e. 4.25 days, which rounds to 4.
If you are not interested in times, use trunc(tr_date)
now by using trunc() im gettinmg the required o/p.