so if you want to know how what's the best algorithm for calculation someone's age based on date of birth, her goes. it's in C# but it can be easily adapted.
DateTime today = DateTime.Today;
int age = today.Year - bday.Year;
if (bday > today.AddYears(-age)) age--;
return age;
No comments:
Post a Comment