4 Replies Latest reply on Mar 14, 2011 2:33 AM by LaRetta_1

# Age Calcuation

### Title

Age Calcuation

### Post

there is a field called "date of birth" in my tables,

and i want to calculate the age automaticaly

i use the function as below:

Get ( CurrentTimeStamp ) - date of birth

the problem is if a person was born on 1982-5-6

he should be 27years.

the machine give me the answers:0028-4-27

how can i solve the problem?

• ###### 1. Re: Age Calcuation

Sorry to be a smart-ass, but that's a pretty easy answer to find:

http://lmgtfy.com/?q=calculate+age+in+filemaker

• ###### 2. Re: Age Calcuation
It's easy to find answers. It's not so easy a find a correct one among them.

Try:
```Let ( [
today = Get (CurrentDate) ;
bDay = Date ( Month ( DOB ) ; Day ( DOB ) ; Year ( today ) )
] ;
Year ( today ) - Year ( DOB ) - ( today < bDay )
)```

• ###### 3. Re: Age Calcuation

This:

It's easy to find answers. It's not so easy a find a correct one among them.

Try:

Let ( [ today = Get (CurrentDate) ; bDay = Date ( Month ( DOB ) ; Day  ( DOB ) ; Year ( today ) ) ] ; Year ( today ) - Year ( DOB ) - ( today  < bDay ) )

Works gets for years and I am using it. I want to use this for another database to calculate how many days a ticket has been open. What do I remove to calculate days from current date vs years???

Thx

• ###### 4. Re: Age Calcuation

"...calculate how many days a ticket has been open"

Subtracting one date from another will produce the result in number of days so where your date field is ticket_date, use calculation of:

Get ( CurrentDate ) - ticket_date

Set the calculation result to number and, in Storage Options, check 'Do not store calculation results - recalculate as needed.'