Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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...
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
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
Seems to work!
Thank you!!
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
Yeah, that solved the problem with the year converting to 2000s instead of 1900s, thank you very much!