Hi all,
I have specific requirements based on date calculations,
two date is important, date of begin to work and sysdate with above cases:
date begin of work 5 may 2012 > 05/03/2012 and sysdate
1) case day of sysdate < day begin to work
02/11/2015 - 03/05/2012 = 2 + 30 - 3= 29 for days 10-5=5 for months and 5-2= 3 for years result is 29 days 5 months 3 years
I have select block which work good on 99% cases, but on cases when day begin to work is bigger then sysdate give
with t(id, dt) as (select 1, to_date('05/3/2012','MM/DD/YYYY') from dual)
select id, dt
,floor(months_between(sysdate,dt)/12) as yrs
,floor(mod(months_between(sysdate,dt),12)) as months
,floor(sysdate-(add_months(dt,floor(months_between(sysdate,dt))))) as dys
from t
result
| ID | DT | YRS | MONTHS | DYS |
|---|
| 1 | 05/03/2012 | 3 | 5 | 30 |
this one day is important, this manual calculation use authorities, so every day is very important.
is there calculations with EXACTLY calculations?
regards