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 7900 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi ...

I need to calculate the age of a person from their date of birth (DOB). I have tried a few calculations from previous posts but have had no success, and not sure why.

I also need to know the number of days till their birthday .... I am not only after an answer to the calculation but the how and why, as I do not fully understand date calculations.

many thanks

Trevors

Posted

Here is a calculation that will work out the age:

NumToText(Year(Today) - Year(D.O.: - Case(Today< Date(Month(D.O.:, Day(D.O.:, Year(Today)), 1, 0))

This calculation will take the year of today and minus the year of the field which contains the users D.O.B

There is then a case statement where I have defined if Today is less than their birthday then minus 1 year off their age, if not minus 0 years.

If you need anymore clarification just post

Ed.

Posted

Eddy,

That's exactly where I'd change Today to Status(CurrentDate) unstored, or these ages would take some ages to recalculate everyday you open the db.

Posted

Try also this ....

Year(Status(CurrentDate)) - Year(Birthdate) - (Status(CurrentDate) < Date(Month(Birthdate), Day(Birthdate), Year(Status(CurrentDate))))

Posted

Right! Think I'm getting it now,

Can I just check though!

If I had a button which when clicked it entered today's date and I did not want this date to change until the button was clicked again is it right that I would use Status(CurrentDate) stored?

But if i want to display today's date on the database I would use Status(CurrentDate) unstored, therefore the next day it would change - BTW I know I can use // for this but just as an example!

And always try to avoid using the Today Function as this has to recalculate each time the database is closed and reopened?

Thanks

Ed

Posted

Hi Trevors,

Take a look at Russ Baker's Handy Bits file in Sample Files. Don't take the first one, it was updated and you find the lastest version towards the bottom.

HTH

Lee

wink.gif

Posted

Many thanks for this ..... I will check Russ Baker's Handy Bits, as I have a few more date calculations to do yet.

Again thanks

Trevors

Posted

Hi journeyman ....

Thanks for your help .... I have one more problem (for now anyway), I can not seem to work out where to start. I need to calculate the days until a persons birthday. I have a field DOB (Date Of Birth), and of course I have the Age field (The age of the person), but how do I calculate the days until the next birthday. I would like to work it out myself but do not know enough about Filemaker pro or programming. Could you please show me where to start, as I would still like to work it out as much as I can.

- DO you add the age (in years) to the DOB?

- Then count the current date to this date in days??

Like I said, I do not really know what I am doing, but enjoy working with Filemaker :-)

Trevor

ThingsOnline

Posted

Hi Trevor,

OK, first let me give you the new calculation to work out age, this is based on Ugo's post above, doing it this way will stop the need for FileMaker to work out the "Today" function as this can take a while - instead we have used the Status(CurrentDate) function.

NumToText(Year(Status( CurrentDate)) - Year(DOB) - Case(Status( CurrentDate)< Date(Month(DOB), Day(DOB), Year(Status( CurrentDate))), 1, 0))

Now, to work out how many days until their next birthday...

Firstly you need to know when their next birthday is. To do this create a new calculation field e.g. NxtBday. As you said you just want to know how to start as you would like to work out as much as you can, I won't give you the actual code but what you need to do is - Their date of birth plus their age in years plus 1 year. If you get stuck let me know and I will post the code for this.

Then all you need to do is what you said:

Their next birthday - Status(CurrentDate)

As I said if you need anymore help with the code, just post again and I'll be pleased to post the code required

Ed.

Posted

Hi ....

Would it be correct to say

NxtBday=Date(Month(DOB), Day(DOB),Year( DOB)+Age+1)

This gives the date of the next birthday

NxtBday-Status(CurrentDate)

Days until next birthday

Trevors

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