A repository of my thoughts, a blog, a source to get insight, know-hows, my views on Software Development and everything else in between......
Friday, April 27, 2012
Calculate Age Function
private int CalculateAge(int year, int month, int day)
{
int age = 0;
age = DateTime.Now.Year - year;
if (DateTime.Now.Month < month)
age--;
if (DateTime.Now.Month == month)
{
if (DateTime.Now.Day < day)
age--;
}
return age;
}
No comments:
Post a Comment