Based on my reading of the docs, there is a simpler way:

var age = new Date(birthDate.getTime() - todayDate.getTime);

Untested.

Tracy

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of JRBower
Sent: Tuesday, October 02, 2007 2:29 AM
To: [email protected]
Subject: Re: [flexcoders] Return a person's age

 


Doug,
Thank you. I will give your code a go. :)

Best Regards,
James

Doug Lowder wrote:
> 
> Here's how I would do it:
> 
> var age:Number = todayDate.fullYear - birthDate.fullYear;
> if (todayDate.month < birthDate.month || (todayDate.month == 
> birthDate.month && todayDate.date < birthDate.date)) age--;
> return age;
> 
> 

-- 
View this message in context:
http://www.nabble.com/Return-a-person%27s-age-tf4545118.html#a12993386
<http://www.nabble.com/Return-a-person%27s-age-tf4545118.html#a12993386>

Sent from the FlexCoders mailing list archive at Nabble.com.

 

Reply via email to