|
Home > Archive > Other Oracle database topics > March 2006 > Calculate age
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
|
| 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.
cheers
Liz
| |
| Michel Cadot 2006-03-21, 3:25 am |
|
"Liz J" < thejordanschangethis
toanatsignclara.net> a écrit dans le message de news: 1142792170.381.0@dyke.uk.clara.net...
| 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.
|
| cheers
|
| Liz
|
|
Show us what you tried and we tell you what's wrong.
Btw, solution depends on Oracle version.
It is mandatory to always include it in your posts.
Regards
Michel Cadot
| |
| Bo Bradham 2006-03-21, 3:25 am |
| Liz J < thejordanschangethis
toanatsignclara.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(sysda
te,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
|
|
|
|
|