Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

This topic is 3467 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi there,

I am trying to subtract two fields to get the age but I got a wrong calculation. I tried to use Getastext but I am missing something. Please help

Today : Get(CurrentDate)

Birthday : Text

Age : Number

Posted (edited)

After converting the birthdate to a date, as Kris said, you can use this calc:

Let([
     g.today = Get(CurrentDate);

     ElapsedYears=Year(g.today) - Year(birthDate) - If(g.today <Date(Month(birthDate); Day(birthDate); Year(g.today)); 1; 0);

     ElapsedMonths =Mod(Month(g.today) - Month(birthDate) + 12 - If(Day(g.today) < Day(birthDate); 1; 0); 12);


     ElapsedDays = Day(g.today) - Day(birthDate) + If(Day(g.today) ≥ Day(birthDate); 0;
 
          If(Day(g.today - Day(g.today)) < Day(birthDate); Day(birthDate); Day(g.today - Day(g.today))))
];



If(birthDate="";"";
     ElapsedYears & " Year" & 
If(ElapsedYears  =  1; "";"s") & ", " 
    

& ElapsedMonths & " Month" & 
If(ElapsedMonths = 1; ""; "s" ) & ", "
    

& ElapsedDays & " Day" & 
If(ElapsedDays =1; ""; "s")


)
)

 

Edited by doughemi

This topic is 3467 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.