306 months = 25 years 6 months (...not 25.5 years)

306 months = 25 years 6 months (...not 25.5 years)

I have a field that contains the number of months that a person has
lived. I can divide by 12 to get the number of years and the decimal
representation of the part of the year (if any) that remains (e.g., 306
months = 25.5 years).
-
What I want, though, is the number of years and the remainder displayed
as months (e.g., 427 months = 35 years, 7 months, etc..).
-
How would I do this? I've looked at various things, like MOD( ), but
I'm not getting it. I hope it is not too simple.
-
Thanks,
David

306 months = 25 years 6 months (...not 25.5 years)

Cant do it the way you want it, months have different number of total days,
can do this very easily by Dates but still involves writing code i.e. Born
on till today...
Mohammed

306 months = 25 years 6 months (...not 25.5 years)

Sorry, but it is:<G>

monthslived=306
yearslived=int(monthslived/12)
partyearmonths=monthslived%12
? monthslived,yearslived,partyearmonths && 306 25 6

Sincerely,

Gene Wirchenko

306 months = 25 years 6 months (...not 25.5 years)

CHEERS... next round is on me

Totally missed the question, was thinking along From - To dates to convert
into years, months & days
Mohammed

306 months = 25 years 6 months (...not 25.5 years)

Thanks very much! Oh, well. I'm glad I asked. Most likely I never
would have come up with a solution...
-
David
==============

306 months = 25 years 6 months (...not 25.5 years)

You can use date arithmetic:

dob=DATE(1964,5,7)
days=DATE()-M.dob
age=DATE(2000,1,)+M.days
? YEAR(M.age)-2000,MONTH(M.age),DAY(M.age)

-Anders

"David" < XXXX@XXXXX.COM > skrev i meddelandet

306 months = 25 years 6 months (...not 25.5 years)

Hi Anders,
Interesting approach, but you did not test it
Last row is
? YEAR(M.age)-2000, MONTH(M.age)-1, DAY(M.age)
hth
Mark

306 months = 25 years 6 months (...not 25.5 years)

Thanks for testing.
Another typo correction;
age = DATE(2000,1,1) + M.days

Should one count as 0 or 1 days old on the day one is born?
-Anders

"Mark" < XXXX@XXXXX.COM > skrev i meddelandet

306 months = 25 years 6 months (...not 25.5 years)

0, since it is a measure of elapsed time.

[snipped previous]

Sincerely,

Gene Wirchenko