Groups | Blog | Home
all groups > sql server reporting services > february 2005 >

sql server reporting services : Birthdate calculation


Mike
2/8/2005 11:35:06 AM
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.


arexey NO[at]SPAM gmail.com
2/8/2005 1:28:17 PM
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.
Mike
2/8/2005 1:57:03 PM
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'.


[quoted text, click to view]
mike
2/8/2005 2:15:06 PM
Subtract NOT Substract
too bad no intellisense in rs to avoid spelling errors.

[quoted text, click to view]
Mike
2/9/2005 5:57:07 AM
Thanks, it's working.

[quoted text, click to view]
AddThis Social Bookmark Button