I needed to calculate a persons age the other day, and came up with this simple code:
DateTime myBirthDay = new DateTime(1970, 9, 5); TimeSpan diffAge = DateTime.Now.Date - myBirthDay.Date; int myAge = new DateTime(diffAge.Ticks).Year - 1;
Related posts
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
© Copyright 2012