Jump to content

The old question! How old are you?


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

Recommended Posts

  • Newbies

I am trying to use the DOB to work out the age from the current date

I can't seem to get it right!!

For example

[color:"red"]DOB (6/22/1988) = 17 Yrs, 0 Mths, -16 Days is not right!!!!

The calculation I am playing with is as below

[color:"blue"](Year(Today) - Year(Date of Birth) - If((Today) < Date(Month(Date of Birth), Day(Date of Birth), Year(Today)), 1, 0)) & " Yrs, " &

(Mod(Month((Today)) - Month(Date of Birth) + 12 - If(Day((Today)) < Day(Date of Birth), 1, 0), 12)) & " Mths, " &

(Today- Date(Month((Today) - (Day(Date of Birth) > Day(Today))), Day(Date of Birth), Year(Today))) & " Days"

Any help will be gratefully accepted [color:"red"]

Link to comment
Share on other sites

Hi Ralph,

I am not happy with any of the many calculations.

LOL, is that because they spell out how old you are. wink.gif

[color:"blue"]Hi Frosty,

I noticed that the one you posted uses the Today Function, It isn't the function of choice for this type of calculation.

This one seems to work.

NumToText(Year(Status(CurrentDate)) - Year(DoB) - If(Status(CurrentDate)<

Date(Month(DoB), Day(DoB), Year(Status(CurrentDate))),

1, 0)) & " Years, " & NumToText(Mod(Month(Status(CurrentDate)) - Month(DoB) + 12 - If(Day(Status(CurrentDate)) < Day(DoB), 1, 0), 12)) & "

Months, " & NumToText(Day(Status(CurrentDate)) - Day(DoB) +

If(Day(Status(CurrentDate)) >= Day(DoB), 0, If(Day(Status(CurrentDate)-Day(Status(CurrentDate))) <

Day(DoB), Day(DoB), Day(Status(CurrentDate)-

Day(Status(CurrentDate)))))) & " Days"

HTH

Lee

Link to comment
Share on other sites

Hi Ralph,

LOL, is that because they spell out how old you are. wink.gif

Lee

That is only part of it. Most of them have major flaws. Like going from Jan 31 to Feb 28 or 29 if leap year gives 0 months and 28 or 29 days while going from Jan31 to Mar 1 gives 1 month and 1 day. You get this in all short months. I like Jason's the best.

Link to comment
Share on other sites

going from Jan 31 to Feb 28 or 29 if leap year gives 0 months and 28 or 29 days while going from Jan31 to Mar 1 gives 1 month and 1 day.

That is not a flaw of the calculation. If Jan 1 to Feb 1 is a full month, then so is Jan 28 to Feb 28. It stands to reason then, that Jan 31 to Feb 28 must be less than a month.

The real problem is mixing units that do not mix well. Objectively, there is no such thing as "age in years, months and days". One has to make some arbitrary assumptions to construct such a beast, and it will always be wrong under different assumptions.

Link to comment
Share on other sites

  • Newbies

Using FMP 7 on Mac Jaguar, I tried Lee's solution (above) with no luck: the "NumToText" function no longer exists in this version (except for Japanese!!!) (I, too, seem to recall having it on earlier FMP versions) confused.gif . While I have found an accurate calculation for age in years only, I still can't do years, months, and days. I'm new to this forum, and I also haven't been able to find the solution by Jason, referred to by RalphL. As much as I like FMP, it's really upsetting that it's so hard to calculate this, and that they haven't simply made this a function (or a number of functions for elapsed time).

Any help would be greatly appreciated.

Link to comment
Share on other sites

Status was changed to Get in v7

GetAsText ( Year(Get(CurrentDate)) - Year(Dob) - If(Get(CurrentDate)<

Date(Month(Dob); Day(Dob); Year(Get(CurrentDate)));

1; 0)) & " Years, " & GetAsText(Mod(Month(Get(CurrentDate)) - Month(Dob) + 12 - If(Day(Get(CurrentDate)) < Day(Dob); 1; 0); 12)) & "

Months, " & GetAsText(Day(Get(CurrentDate)) - Day(Dob) +

If(Day(Get(CurrentDate)) >= Day(Dob); 0; If(Day(Get(CurrentDate)-Day(Get(CurrentDate))) <

Day(Dob); Day(Dob); Day(Get(CurrentDate)-

Day(Get(CurrentDate)))))) & " Days"

I think I saw a better calculation for v7, here, I'll try and find it and post a link later.

Lee cool.gif

Link to comment
Share on other sites

  • Newbies

To add just a little more: FM's own KB (which I couldn't connect to yesterday) provided the following formula (at Calculating Elapsed Time Between Two Dates Broken Into Year, Month, And Day ).

At age around 65, FM's formula makes someone the same age as Lee's formula.

If you really get obsessive, as I did, and replaced what FM calls a year in their formula, 365.25 days, with what I found on the web, 365.242199, which also shortens the average length of a month to 30.4368499, the difference is 1 day older (over a span of 65+ years) according to the FM formula.

George Beer-Chug.gif

Link to comment
Share on other sites

Well, the question how many AVERAGE years and/or months have elapsed between two dates is very different from the question how many ACTUAL years and/or months have elapsed on the calendar.

BTW, 365.242199 days is the average length of the tropical year - the average Gregorian calendar year length is 365.2425 days.

Link to comment
Share on other sites

  • Newbies

Well, the question how many AVERAGE years and/or months have elapsed between two dates is very different from the question how many ACTUAL years and/or months have elapsed on the calendar.

How does this affect the FM calculations above? To what extent is the difference of practical significance?

BTW, 365.242199 days is the average length of the tropical year - the average Gregorian calendar year length is 365.2425 days.

So which number is more appropriate for FM calculations? In any case, it would seem that 365.25 is inaccurate, and should not be used. Right?

George

Link to comment
Share on other sites

The practical significance of the difference depends on the purpose of the calculation. Being one day off may be insignificant when compiling the workforce statistics; it can be disastrous when calculating individual birthdays.

The same applies to the length of the average year/month. There are no correct answers here. It all depends on what are you trying to accomplish. For example, in the period between 1904 to 2100 the average calendar year is indeed 365.25 days, so if you're trying to approximate the calendrical result in this range, 365.25 might be more appropriate. In an astronomical context, 365.242199 would be much better.

The bottom line is that Earth's rotation around its axis is not synchronized to Earth's revolution around the Sun - not to mention the Moon. Filemaker COUNTS in days, and is AWARE of calendar months and years. It cannot translate x days into y months/years, because each month/year has its own length in days. This is NOT like converting inches into centimeters. The phrase "age in years, months and days" is as meaningful as "length in miles, footsteps and rubber bands".

Link to comment
Share on other sites

  • Newbies

Now I think I understand. It seems to boil down to a difference between scientific accuracy and convention. The former isn't practical for most everyday use, and the convention is practical and accurate enough.

Thanks, comment, for taking the time. I've learned good things from you and Lee.

Link to comment
Share on other sites

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