Page 2 of 2

Re: HMG Program to Calculate your Age!

Posted: Sun Aug 03, 2008 4:18 pm
by Rathinagiri
I never thought this would pick up this much speed actually.

:)

Re: HMG Program to Calculate your Age!

Posted: Sun Aug 03, 2008 5:06 pm
by esgici
Pete-WG wrote:
... here is a "quick and dirty" version of your Dif2Date() function.

I very suspect that It has some problem(s), though... (particularly regarding years). Please make some tests, to see what i mean.
Yes, you are right, very hasty and dirty :(

If 21/06/1957 is your birtday you are in 1951 year old. And if today is your anniversary you have no lived ( diff is 0 year, 0 month and 0 day ).

IMHO years is not problem, may be fix. Problem is when any partial element ( year, month, day) is zero ( out of range ).

"Please make some tests, to see what i mean."

A solution may be instead of date type data, return value of diffdate function will be an array with three numeric element.

Regards

esgici

Re: HMG Program to Calculate your Age!

Posted: Mon Mar 16, 2009 5:09 am
by swapan
Hello Everybody! I came to know about this forum from Sudip. A special thanks to him, it seems everybody here are very helpful.

Thanks Giri for your age calculation sample. I've lost my clipper code of age calculation and this will help me. Not gone through your code minutely, hope it takes care of leap year factor during calculation.


Regards,

-- Swapan

Re: HMG Program to Calculate your Age!

Posted: Mon Mar 16, 2009 6:09 am
by Rathinagiri
Welcome Swapan.

The logic is just (years - years), (months - months) and (days - days) and I am afraid I had not considered leap year factor.