It might be best to trunc() the dates before doing the math, depending on
what date values you may have, and what your intended effect is.
This returns 19.99...
select to_date('28-AUG-2002 23:59:59') - to_date('09-AUG-2002 00:00:01')
from dual
This returns 20
select ceil(to_date('28-AUG-2002 23:59:59') - to_date('09-AUG-2002
00:00:01'))
from dual
This returns 19
select trunc(to_date('28-AUG-2002 23:59:59')) - trunc(to_date('09-AUG-2002
00:00:01'))
from dual
Dan
-----Original Message-----
From: Alex Ninan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 10:16 AM
To: CF-Talk
Subject: RE: days between function in Oracle...
lets say I have certain dates (x) and (y)
now I do a ((x) - (y)) in oracle and I get a number like 18.12 or 18.82
I was doing a round of the result above which yielded me 18 or 19 based on
the percentile. While I was expecting 19 always, the ceil function helped me
to achieve that.
Hope that helps clarify the question... More of a rounding issue.
-----Original Message-----
From: Alex [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 20, 2002 10:10 AM
To: CF-Talk
Subject: Re: days between function in Oracle...
ceiling() will round up
What's your question ...days beween dates or rounding?
On Tue, 20 Aug 2002, Alex Ninan wrote:
> Hi,
>
> Does anyone know of a function I can use to get the number of days between
2
> dates in Oracle. My basic problem is I can get the dates but on using the
> round function it's screws up...
>
> e.g
> round(18.12) = 18 days
> round(18.82) = 19 days
>
> What I want is a function which does
>
> function(18.12) = 19 days
> function(18.82) = 19 days
>
> Thanks
>
> Alex
>
>
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists