Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Calculate age
Liz J <thejordanschangethistoanatsignclara.net> wrote:
>If I have an entity Student and there is an attribute DOB holding the
>student's date of birth, how can I calculate his age today in years and
>months?
>
>Have been trying this but can't seem to get the syntax right.
Try
months_between(sysdate,date_of_birth)
That will return age in months as of sysdate.
You can divide the result by 12 for years. If decimal fractions of a year are ok, as opposed to months, that's it. Otherwise you can use mod() to get the months.
Bo Received on Sun Mar 19 2006 - 18:14:23 CST