Age

M

Mo

There are a number of ways of working out the age of a person, from the
obvious:

'DateDiff("yyyy",[dob],date())',

to the rather more complex

'Int((DateDiff("s",[dob],date())/31556952))', which works out the age
based on the accepted standard of 365.2425 days in the year.



However, neither of the above work out the age in quite the way I want
it. I would like to work out ages by month, so that if my 30th birthday
were on 30th December 2005 and I worked out my age in December it would
be displayed as as '30' regardless of the date. If I worked out my age
for December 2006, it would be 31 etc, etc.

I'm sure this can be done quite easily, but I can't think of a way. Can
someone help?

TIA,

Mo
 
J

John Spencer

So the question is - what is my age as of the last day of the month? Since
DateDiff calculates month boundaries crossed, I think the simplest formula
is

Age: Int(DateDiff("m",Dob,Date())/12)
Or
DateDiff("m",DOB,Date)\12
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top