Age calculation script
JimAultWins at yahoo.com
Sat Sep 9 17:54:11 CDT 2006
Sarah Reichelt has dealt with the various ways of doing date calcs on
computer operating systems and has more info on her web site at
www.troz.net. (See below)
The basic issues are that different platforms regard two-digit years
differently, and time/date functions will fail at some point in the past and
in the future. To the system calculation, 06 may equal 1906 instead of
2006, or 40 may equal 2040 instead of 1940. The author of a loop needs to
test even the simplest of these functions on the various platforms.
It sure seems simple, but the complexities of the operating systems and the
apps that run on them usually cause variations and errors. Such is the
My approach to birthdays was to use dateitems year-by-year to allow the
speed of Rev to count back and find the leap years so that it can handle the
exception of a baby born on Feb 29th. They still should receive a card
every year. By counting backwards, there is no doubt as to which century
the function will be in, regardless of the Rev centuryCutoff setting.
In this case, it works on the Mac, but not on Windows. Sounds simple until
you test it, then scratch your head wondering
"Why -64800 instead of 1969,1,12,1,0,0,4" on Windows XP?
-------- as promised ----------------------
A collection of date and time functions for extracting certain bits of date
information and for performing date & time conversions and calculations.
Updated to include new functions for ISO week number, Julian dates, Easter,
relative date calculations etc. Thanks to Eric Chatonet and Mark Weider for
their contributions to this library.
On 9/9/06 1:18 PM, "Graham Samuel" <livfoss at mac.com> wrote:
> On Fri, 8 Sep 2006 14:22:43 +0200, "William de Smet"
> <wdesmet at wanadoo.nl> wrote:
>> Hi there,
>> For an educational app I want to calculate someone's age based on date
>> of birth and todays date but I don't know how to start!
>> I made a field in which the user puts its 'date of birth' (dd/mm/yy)
>> and a button that needs to compare 'todays date' and the 'date of
>> The output needs to be : age and months (and days?)
> It's late and maybe I have missed the point, but why have all the
> scripts in this thread been so complicated? William seems to want
> answers like "20 years, 6 months and three days". If one knows the
> year of a person's birth - which can easily be converted into a full
> 4-digit number, and one knows the current year (ditto), then by
> subtraction one knows the number of years the person has been alive.
> After that, all you need to know is whether the person's birthday has
> already occurred this year or not, and the number of days (365 or
> 366) in this year. AFAIK, what we mean by "20 years, 6 months and 3
> days" is actually "6 months and three days after his/her 20th
> birthday": it is not necessary to count precisely the number of days
> the person has been alive. What did I miss in thinking like this?
More information about the use-livecode