Page 1 of 1

### Age Calculator

Posted: Sun Aug 13, 2017 2:50 am
Has anyone come up with a way to determine the age and month of a person if given a date line 02/22/1877?

### Re: Age Calculator

Posted: Sun Aug 13, 2017 10:43 am

Nothing like THAT on a Sunday to whet my teeth.
HOT DATE.livecode.zip
Here's the stack
I'm a sadistic "tiddly-pom" so I'll leave you to convert the seconds back into DAYS and YEARS.

### Re: Age Calculator

Posted: Sun Aug 13, 2017 2:13 pm
richmond62 wrote:I'm a sadistic "tiddly-pom" so I'll leave you to convert the seconds back into DAYS and YEARS.
Where is the Months then?

### Re: Age Calculator

Posted: Sun Aug 13, 2017 3:36 pm

### Re: Age Calculator

Posted: Sun Aug 13, 2017 4:04 pm
Awesome richmond, just pure awesome

### Re: Age Calculator

Posted: Sun Aug 13, 2017 4:15 pm
Richmond,

Im impressed you were able to refer back to an old Hypercard book. Thanks, Max

### Re: Age Calculator

Posted: Sun Aug 13, 2017 4:32 pm
just divide by 31536000 to get the age.

### Re: Age Calculator

Posted: Sun Aug 13, 2017 4:46 pm
Hi,
I'm afraid that is a little more complicate.
@Max
Are you sure that it works with a date < 1/1/1970 (as first post 1877)
Best regards
Jean-Marc

### Re: Age Calculator

Posted: Sun Aug 13, 2017 4:58 pm
It may be useful to read the thread "When was the Big Bang" to get old, old dates. 1877 is a no-brainer. The Jurassic era requires extra coding.

viewtopic.php?f=9&t=26619&p=138530&hili ... ng#p138530

Craig

### Re: Age Calculator

Posted: Sun Aug 13, 2017 5:23 pm
Im impressed you were able to refer back to an old Hypercard book.
At 55, I'm a bit of an old book . . . and perpetually fighting with my wife who wants to chuck things
out all the time.

She "went a bit funny" when I managed to retrieve a whole 5 years worth of her academic work she thought was lost forever from a
load of ZIP disks . . . which I read through a SCSI ZIP drive connected to a SCSI PCI card connected to a machine running Ubuntu Linux.

No more fights

### Re: Age Calculator

Posted: Sun Aug 13, 2017 5:23 pm
Finally, big bang was a sunday

### Re: Age Calculator

Posted: Sun Aug 13, 2017 6:49 pm
On Windows,1877 is not a date. Nothing existed before 1970.

http://quality.livecode.com/show_bug.cgi?id=4941

To me, this is the single most inexplicable (that it has not been addressed in all this time, and that I seem to be in a very small minority with this opinion), serious and unacceptable thing in the qcc

### Re: Age Calculator

Posted: Mon Aug 14, 2017 10:35 am
You could use Malte's libdate, see his announcement here:
viewtopic.php?p=123544#p123544

For the age in number of days see the second box at right of his demo stack from github
https://github.com/derbrill/libdate

### Re: Age Calculator

Posted: Mon Aug 14, 2017 1:48 pm
Thanks Hermann, I already know and use Malte's library.
I just find it incredible that something so fundamental is not being addressed natively.

### Re: Age Calculator

Posted: Mon Aug 14, 2017 5:00 pm
My link was for the OP's question, not for you! How can you assume that?!

Of course you are right with your opinion about tdate and time on Win, but don't forget, that LC goes even 10 years back before the birth date of DOS

p.s.
I read the OP's question again, thoroughly. He doesn't need any date or time lib, as he is asking for years and months only, not for days or seconds.
So we have only 2 to 4 'direct' additions/subtractions and 2 comparisons to get the result (here 140 years and 5 months):

Code: Select all

``````on mouseUp