Calculating an Age in C# From a Date of Birth
Just a quickie - if you've got a date of birth, you can get and age using the following formula. It's based on the code at http://www.developerfusion.co.uk/show/4671/, but I've simplified it a bit:
// get the difference in years
int years = DateTime.Now.Year - dateOfBirthDate.Year;
// subtract another year if we're before the
// birth day in the current year
dateOfBirthDate = dateOfBirthDate.AddYears(years);
if (DateTime.Now.CompareTo(dateOfBirthDate) < 0) { years--; }
return
years;