4 Replies Latest reply: Feb 15, 2012 4:05 AM by Maria Karlsson

# Help with date and age

Hi,

Im struggling to find a way to convert a number to date and then date to age. I have numbers that look like YYMMDDXXXX where Id like to use the date and from that get the age of the person. So first off, how du I exclude the last 4 numbers and add "19" to the year? And then how do I calculate age today from the date?

Pls help...

• ###### Help with date and age

this should do what you need

Date(Date#(LEFT(Date_Field,6),'YYMMDD')) AS New_Date
Age(Today(),Date#(LEFT(Date_Field,6),'YYMMDD')) AS Age_Field

• ###### Help with date and age

Seems to work!

Thank you!!

• ###### Help with date and age

Hi

Try with this expression

MakeDate(left(Field,2),Mid(Field,3,2),Mid(Field,5,2)) as Date

Age(Today(),MakeDate(left(Field,2),Mid(Field,3,2),Mid(Field,5,2))) as Age

or

Date(Date#('19'&LEFT(Field,6),'YYYYMMDD')) AS Date

Age(Today(),Date#('19'&LEFT(Field,6),'YYYYMMDD')) AS Age

Use the one which is comfortable for you

Celambarasan

• ###### Help with date and age

Yeah, that solved the problem with the year converting to 2000s instead of 1900s, thank you very much!