Re: Computing the age of a person?

2009-05-15 Thread Kay C Lan
As some people probably want a more accurate representation of age rather than in whole years, here's another function, this outputs yy,mm,dd as in 21,5,26. The really cool bit about this is from my meager testing it appears to take into account leap years. This is based around a cool piece of

Computing the age of a person?

2009-05-14 Thread kl...@major.on-rev.com
Hi all, I could need a hint on how to compute the age of a person when I have the birthday. The convert to seconds and subtraction part is easy, but how to proceed? :-) Thanks in advance! Best Klaus -- Klaus Major http://www.major.on-rev.com kl...@major.on-rev.com

Re: Computing the age of a person?

2009-05-14 Thread Jim Sims
On May 14, 2009, at 4:39 PM, kl...@major.on-rev.com wrote: I could need a hint on how to compute the age of a person when I have the birthday. The convert to seconds and subtraction part is easy, but how to proceed? :-) Thanks in advance! A hint: Mathematics. sims In the

Re: Computing the age of a person?

2009-05-14 Thread kl...@major.on-rev.com
Hi sims, On May 14, 2009, at 4:39 PM, kl...@major.on-rev.com wrote: I could need a hint on how to compute the age of a person when I have the birthday. The convert to seconds and subtraction part is easy, but how to proceed? :-) Thanks in advance! A hint: Mathematics. Geeez,

Re: Computing the age of a person?

2009-05-14 Thread Jim Sims
On May 14, 2009, at 4:39 PM, kl...@major.on-rev.com wrote: I could need a hint on how to compute the age of a person when I have the birthday. The convert to seconds and subtraction part is easy, but how to proceed? :-) Ok, another suggestion. Maybe: calculate how many days that it has

Re: Computing the age of a person?

2009-05-14 Thread Mark Schonewille
Hi Klaus, Please test: function age theDate set the useSystemDate to true convert theDate to dateItems put the date into myToday convert myToday to dateitems put item 1 of myToday - item 1 of theDate - 1 into myAge put item 1 of myToday into item 1 of theDate

Re: Computing the age of a person?

2009-05-14 Thread J. Landman Gay
kl...@major.on-rev.com wrote: Hi all, I could need a hint on how to compute the age of a person when I have the birthday. The convert to seconds and subtraction part is easy, but how to proceed? :-) My variation, if all you need is the year: function getAge pDate put the date into tNow

Re: Computing the age of a person?

2009-05-14 Thread Devin Asay
On May 14, 2009, at 9:17 AM, J. Landman Gay wrote: kl...@major.on-rev.com wrote: Hi all, I could need a hint on how to compute the age of a person when I have the birthday. The convert to seconds and subtraction part is easy, but how to proceed? :-) My variation, if all you need is the

Re: Computing the age of a person?

2009-05-14 Thread Bob Sneidar
Youd better be careful. The way Rev is calculating math these days, depending on your method, you might end up inferring a woman is 43 x 1 to the 13th power. :-) Bob Sneidar IT Manager Logos Management Calvary Chapel CM On May 14, 2009, at 7:39 AM, kl...@major.on-rev.com wrote: Hi all, I

Re: Computing the age of a person?

2009-05-14 Thread Klaus on-rev
Hi Jaqueline and Mark, Hi Klaus, Please test: function age theDate set the useSystemDate to true convert theDate to dateItems put the date into myToday convert myToday to dateitems put item 1 of myToday - item 1 of theDate - 1 into myAge put item 1 of myToday into item

Re: Computing the age of a person?

2009-05-14 Thread Klaus on-rev
Hi Bob, Youd better be careful. The way Rev is calculating math these days, depending on your method, you might end up inferring a woman is 43 x 1 to the 13th power. :-) Don't worry, I am a gentleman by nature and always have this li'l function handy: function le_chevalier tGender,

Re: Computing the age of a person?

2009-05-14 Thread René Micout
Sacha Guitry said : Une femme compte son âge de la manière suivante : trente sept, trente huit, trente neuf, trente dix, trente onze, trente douze, ... In english (?) : A woman counting his age : thirty seven, thirty eight, thirty nine, thirty ten, thirty eleven, thirty twelve, ... :-) René

Re: Computing the age of a person?

2009-05-14 Thread J. Landman Gay
Klaus on-rev wrote: Hi Bob, Youd better be careful. The way Rev is calculating math these days, depending on your method, you might end up inferring a woman is 43 x 1 to the 13th power. :-) Don't worry, I am a gentleman by nature and always have this li'l function handy: function

Re: Computing the age of a person?

2009-05-14 Thread J. Landman Gay
Devin Asay wrote: function getAge pDate put the date into tNow convert pDate to dateitems convert tNow to dateitems repeat with x = 1 to 3 put item x of tNow - item x of pDate comma after tAge end repeat if item 2 of tAge 0 or item 3 of tAge 0 Shouldn't this be

Re: Computing the age of a person?

2009-05-14 Thread Colin Holgate
On May 14, 2009, at 12:33 PM, J. Landman Gay wrote: LOL! Smart man. :) Are you sure he's a man? Also, he should have said: function le_chevalier tGEner,tReal_age if tGender = f then return min(39,tReal_age) return tReal_age end le_chevalier no need for the AND or the ELSE parts.

Re: Computing the age of a person?

2009-05-14 Thread Klaus on-rev
Hi Colin, On May 14, 2009, at 12:33 PM, J. Landman Gay wrote: LOL! Smart man. :) Are you sure he's a man? I just took a look, and yes, I am, Mr. Chauvi :D Also, he should have said: function le_chevalier tGEner,tReal_age if tGender = f then return min(39,tReal_age) return tReal_age

Re: Computing the age of a person?

2009-05-14 Thread Devin Asay
On May 14, 2009, at 10:37 AM, J. Landman Gay wrote: Good catch. Yes, it should be what you say. So much for quick solutions. :) Don't feel bad. My own attempt was a wash. I was using seconds to calculate the time from the beginning of the birth year to the birthdate, then comparing

Re: Computing the age of a person?

2009-05-14 Thread Sarah Reichelt
Now we'll wait for Sarah R. to come on board and show us how it's really done! I think you've already got it, but I couldn't resist this challenge :-) From my DateTime library http://www.troz.net/Rev/libraries/DateTime.rev.gz I took the following function: -- daysBetween(date1, [date2])

Re: Computing the age of a person?

2009-05-14 Thread Brian Yennie
I think the scripting competition permanently damaged me... clearly this is a one-liner! function le_chevalier tGender,tReal_age return 39 + offset(tGender, m) * (tReal_age - 39) end le_chevalier function le_chevalier tGEner,tReal_age if tGender = f then return min(39,tReal_age) return

Re: Computing the age of a person?

2009-05-14 Thread Colin Holgate
On May 14, 2009, at 4:58 PM, Brian Yennie wrote: function le_chevalier tGender,tReal_age return 39 + offset(tGender, m) * (tReal_age - 39) end le_chevalier I think that might say that all females are 39. ___ use-revolution mailing list

Re: Computing the age of a person?

2009-05-14 Thread Brian Yennie
LOL, I told you I was permanently damaged!!! On May 14, 2009, at 4:58 PM, Brian Yennie wrote: function le_chevalier tGender,tReal_age return 39 + offset(tGender, m) * (tReal_age - 39) end le_chevalier I think that might say that all females are 39.

Re: Computing the age of a person?

2009-05-14 Thread Peter Brigham MD
Here's what I use: function doAge bd,asOf -- bd = birthdate in short date form -- asOf = (optional) short date --age is calculated as of date asOf --or as of today if omitted if sws(bd) = then return end if if asOf = then put the short date into asOf end if

Re: Computing the age of a person?

2009-05-14 Thread Kay C Lan
Peter, I gave your function a try and it gave the wrong answer. I had a quick look and somewhere along the line it converted 2009 to 1909, so I ended up with a negative age. After some of the earlier posts, I guess it has potential for a female audience. Here's my attempt: FUNCTION calcAge