Friday, May 8, 2009

Calculate Age from the DateOfBirth

Hi,
Here is the program with the three line to calculate the age from the DOB

long yrs = 0;
DateTime bdayDate = new DateTime(2010, 07, 17);
TimeSpan ts = DateTime.Now.Subtract(bdayDate);
yrs = ts.Days / 365;
Response.Write(yrs);

No comments: