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;


--- In [email protected], JRBower <[EMAIL PROTECTED]> wrote:
>
> 
> I have a form where I request a birthdate. I would like to 
automatically
> calculate a person's age (for another input) from the difference of 
today's
> date and the inputted birthdate. I'm not exactly sure how to write 
the
> function. I the following right?
> 
> public function dateDiff(todayDate:Date, birhtDate:Date):void 
> { 
>         var todayDate:Date(); 
>         var birthDate:Date;
>         var age = birthDate - todayDate;
> } 
> 
> Thanks for your help,
> 
> James
> -- 
> View this message in context: http://www.nabble.com/Return-a-person%
27s-age-tf4545118.html#a12970134
> Sent from the FlexCoders mailing list archive at Nabble.com.
>


Reply via email to