I am trying to calculate an individual's age by using the individual
birthdate (i.e. 02/12/1982) and subtracting the date from the current date.
Then divide the answer by 365.25.
When I format the dates as MMddyyyy and the subtract the individual
birthdate from the current date. Then divde the answer by 365.25. I am
getting the wrong number.
Do I need to convert the dates to an interger? If so, I have not found any
examples.
Thanks.You should be able to do something like:
=System.DateTime.Now.Substract (System.DateTime.Parse
(Fields!Birthday.Value)).TotalDays / 365.25
unless your field is already a datetime in which case you dont need to
Parse.|||I put the code in the Expression field.
=System.DateTime.Now.Substract (System.DateTime.Parse
(Fields!CREATION_DATE.Value)).TotalDays / 365.25
I am getting the message: Substract is not a member of 'Date'.
"arexey@.gmail.com" wrote:
> You should be able to do something like:
> =System.DateTime.Now.Substract (System.DateTime.Parse
> (Fields!Birthday.Value)).TotalDays / 365.25
> unless your field is already a datetime in which case you dont need to
> Parse.
>|||Subtract NOT Substract
too bad no intellisense in rs to avoid spelling errors.
"Mike" wrote:
> I put the code in the Expression field.
> =System.DateTime.Now.Substract (System.DateTime.Parse
> (Fields!CREATION_DATE.Value)).TotalDays / 365.25
> I am getting the message: Substract is not a member of 'Date'.
>
> "arexey@.gmail.com" wrote:
> > You should be able to do something like:
> >
> > =System.DateTime.Now.Substract (System.DateTime.Parse
> > (Fields!Birthday.Value)).TotalDays / 365.25
> >
> > unless your field is already a datetime in which case you dont need to
> > Parse.
> >
> >|||Thanks, it's working.
"mike" wrote:
> Subtract NOT Substract
> too bad no intellisense in rs to avoid spelling errors.
> "Mike" wrote:
> > I put the code in the Expression field.
> > =System.DateTime.Now.Substract (System.DateTime.Parse
> > (Fields!CREATION_DATE.Value)).TotalDays / 365.25
> >
> > I am getting the message: Substract is not a member of 'Date'.
> >
> >
> > "arexey@.gmail.com" wrote:
> >
> > > You should be able to do something like:
> > >
> > > =System.DateTime.Now.Substract (System.DateTime.Parse
> > > (Fields!Birthday.Value)).TotalDays / 365.25
> > >
> > > unless your field is already a datetime in which case you dont need to
> > > Parse.
> > >
> > >
Friday, February 10, 2012
Birthdate calculation
Labels:
age,
birthdate,
calculate,
calculation,
current,
database,
date,
individual,
microsoft,
mysql,
oracle,
server,
sql,
subtracting
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment