Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: oracle dates calculations
"DangerMouse" <nospam_at_nospam.com> wrote in message
news:3z_Ka.119$Ls.1551_at_newsfep4-glfd.server.ntli.net...
> "Eric Parker" <eric.parker.spamless_at_virgin.net> wrote in message
> news:duZKa.2173$MO2.2161_at_newsfep4-winn.server.ntli.net...
> >
> > "Jim Kennedy" <kennedy-downwithspammersfamily_at_attbi.com> wrote in
message
> > news:zAYKa.33045$Ab2.58464_at_sccrnsc01...
> > > 1. dates are not strings. dates are displayed and that is what you
are
> > > seeing. Subtract the date of birth and today (sysdate) and if the
> > > difference is >= 18 * 365 then the individual is 18.
> > > Jim
> > > "jim agans" <jwagans_at_yahoo.com> wrote in message
> > > news:82659da6.0306270629.68eee0cd_at_posting.google.com...
> > > > I have a date of birth.....'MMDDYYYY' What I need to do is find out
if
> > > > the individual is 18 years old on this date.
> > > > How can I do it ...any help someone?
> > > >
> > > > thanks
> > > > jim
> > >
> > >
> >
> > Jim(s)
> >
> > There will be inaccuracies due to leap years with 18*365.
> > I would try something based on
> > add_months(sysdate, -12*18).
> > You could still have problems with leap years though.
> >
> > HTH
> >
> > eric
> >
> >
>
> Just use months_between and divide by 12 to get the number of years.
Oracle
> handles the leap years.
>
What I was wondering about was the standard (if there is one) way of dealing
with somebody whose birthday was 29th Feb. Does their birthday become
28th Feb or 1st Mar on non-leap years ?
I know from an Oracle point of view what I'd prefer.
eric Received on Fri Jun 27 2003 - 12:41:03 CDT