HMG Program to Calculate your Age!

HMG Samples and Enhancements

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG Program to Calculate your Age!

Post by Rathinagiri »

I never thought this would pick up this much speed actually.

:)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: HMG Program to Calculate your Age!

Post 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
Last edited by esgici on Fri Nov 04, 2011 5:09 pm, edited 1 time in total.
Viva INTERNATIONAL HMG :D
User avatar
swapan
Posts: 242
Joined: Mon Mar 16, 2009 4:23 am
Location: Kolkata, India
Contact:

Re: HMG Program to Calculate your Age!

Post 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
Thanks & Regards,
Swapan Das

http://www.swapandas.com/
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMG Program to Calculate your Age!

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Post Reply