From: yok on
"Miki Nikolic" <mni(a)e-mid.dk> wrote in message <40048534$0$30078$edfadb0f(a)dtext01.news.tele.dk>...
> Hi,
> Can somebody help me with a accurate way to calculate the age of a person
> when
> the input to the function is the date of birth in the form DD/MM/YYYY?
>
> I was trying for example:
> >>(datenum('09/29/1972')-datenum('09/29/1967')-1)/365
> ans =
> 5.0027
> >> (datenum('09/29/1971')-datenum('09/29/1967')-1)/365
> ans =
> 4
> I was expecting the first one to return 5 but the result was 5.0027
>
> Thanks
> Miki
>
>
try this
x=(datenum('09/29/1972')-datenum('09/29/1967')-1)/365
round(x)