The problem with calculating the difference in years is that the legth of a
year is not a definite timespan (actual number of days in a year depends on
its number). Same problem is applicable to months... (As the documentation
states : "Due to a varying number of days in months and years, the longest
unit of time that is used by TimeSpan is the day.")
"Ron Vecchi" <ve******@comcast.net> wrote in message
news:uf**************@TK2MSFTNGP12.phx.gbl...
I need to calculate the age of a person based on a DateTime BirthDate
I was thinking
TimeSpan ts = DateTime.Now - BirthDate;
//I can get the days but not years.
// I could check each year from their year of birth, count the days in
the year and compare with the days returned from timespan
but isn't there a easy way to check the difference in years?
Thanks,
Ron Vecchi