Nothing in-built that I know of. Leap years are always the trick
(technically not always 1-in-4) ... not hugely graceful, but the following
is at least easy to understand... (done this way as DayOfYear is not so
reliable in a leap year):
Marc
public static void Main() {
DateTime dob = new DateTime(1946, 5, 31);
DateTime today = DateTime.Today, tomorrow = today.AddDays(1);
Console.WriteLine(GetAge(dob, today));
Console.WriteLine(GetAge(dob, tomorrow));
}
public static int GetAge(DateTime dob, DateTime from) {
int years = from.Year - dob.Year;
if ((dob.Month > from.Month) || (dob.Month == from.Month && dob.Day
from.Day))
years--; // haven't had a birthday yet
return years;
}