Wouldn't that produce a negative number, given that birthDate probably comes before todayDate?
Discounting that, I think that would give you the person's age in milliseconds. --- In flexcoders@yahoogroups.com, "Tracy Spratt" <[EMAIL PROTECTED]> wrote: > > Based on my reading of the docs, there is a simpler way: > > var age = new Date(birthDate.getTime() - todayDate.getTime); > > Untested. > > Tracy > > ________________________________ > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of JRBower > Sent: Tuesday, October 02, 2007 2:29 AM > To: flexcoders@yahoogroups.com > 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. >