Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I thought I could search for an age calc, but no luck.

I tried this, which is close, but /365 isn't going to work out perfect.

Floor ( (Get ( CurrentDate ) - (birthdate) )/ 365 )

What is the best way to do an age calc?

Thanks Dave

Posted

Thanks, I searched for an age calc, (nothing)

Then I searched for birthday, seems like everyone wanted something a little different than just a birthday.

I tried your calc, birthday = 8/25/2000

todays date = 8/24/2006

your calc returned age = 6

I would hope this would return 5.

It is very close.

I would think that the calc has got to compare the day of the month, with the month and year, to work out perfectly. I am just unsure how to do it.

Thanks for taking the time to help me.

Dave

Posted

I thought this might work, but I am not writing it correctly

Let ( GetAsNumber ( Year ( CurrentDate ) ) - GetAsNumber ( Year ( birthdate ) ) ;

year ;

GetAsNumber ( Month ( CurrentDate ) ) ;

month ;

GetAsNumber ( Day ( CurrentDate ) ) ;

day ;

Case (

GetAsNumber ( Month ( birthdate ) ) > month ; year - 1 ;

GetAsNumber ( Month ( birthdate ) ) < month ; year ;

GetAsNumber ( Day ( birthdate ) ) > day ; year - 1 ;

year )

)

I think you can see what I was going for.

Dave

Posted

Dave, what is the format you want as the result?

Number only of the year? A text display of 2 years 5 months 2 weeks 3 days? What do you want here? And what are the two dates which will determine your results? Is a the current date against another date or two date fields?

Posted

If you want simple number of years, use calculation ( unstored, number) with:

Let ( [

now = Get ( CurrentDate ) ;

DOBnow = Date ( Month ( birthdate ) ; Day ( birthdate ) ; Year ( now ) )

] ;

Year (now ) - Year ( birthdate ) - ( now < DOBnow )

)

L

Posted

Thanks, that is perfect.

I take it that

( now < DOBnow )
will return 0 if true and 1 if false?

Thank you very much,

Dave

Posted

"...will return 0 if true and 1 if false?"

Actually the other way around. This is a boolean test which produces 1 for true and 0 for false. So if the current date is less than the birthday this year (meaning the birthday hasn't been reached yet) then the result is true and subtracts 1 (year).

This topic is 6667 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.