1. Age Calculation

I found a lot of information about how to calculate the age but none seems to be simple enough to use when calculating Age form the given date of birth.

How to do this in a grid??

2. Re: Age Calculation

Are you able to create a calculated field/column in a grid?

AGE( birthdate as D [, As_of_date as D ] )

The As_of_date defaults to the current date so if you want the current age

AGE( birthdate as D)

Dt is a date field in the table represented.

3. Re: Age Calculation

Thank you Stan!!

this looks nice! I will try it and let you know!

Marios

4. Re: Age Calculation

It seems that this is not possible to my case because I am not using DBF table.
I am using a SQL Table (MySQL on a cloud) and the option of inserting a calculated field or colum is not there (or I can't find it)!
Is thre a way to make in the way you suggest it when using SQL Tables??

Many Thanks again.

5. Re: Age Calculation

With SQL tables I think you will have to define the age column in the SELECT statement. I'm certainly no expert at that. I do see that you can do this in the Enterprise Reporting section using the Expressions Tab.

6. Re: Age Calculation

This works with the Northwind sample database.

Code:
```SELECT EmployeeID, LastName, FirstName, BirthDate,  YearsBetweenDates(Birthdate,  Now() )  AS Age
FROM Employees```

7. Re: Age Calculation

This works in Mysql

Code:
`((date_format(now(),'%Y') - date_format(`employees`.`birth_date`,'%Y')) - (date_format(now(),'00-%m-%d') < date_format(`employees`.`birth_date`,'00-%m-%d')))`

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•